Moved my WordPress plugins to GitHub

Some people love Git, others hate it. I’m part of the first group of people. I love the way decentralized  version control systems work. Git was the first I ran into, only using SVN by that time. At first it was hard to switch from my habits in SVN, to a more flexible version control system like Git. But once you make the switch, start using everything that makes Git the great system that I think it is, you will dislike every time you have to use SVN again.

Since Git works with a local repository and remote repositories, you can commit changes to your local repository without pushing these commits to the remote repository. That makes Git fast and more flexible. You can even have complete branches on your local environment only, without publishing them. That way you can work on large parts of code without having to be connected to the central remote repository all the time.

That is just one of the many advantages Git (or any other decentralized version control system) has over centralized version control systems. If you need more information on why Git is so popular, check out the recently updated Git website and documentation.

So then there is GitHub

GitHub is the social coding tool of my choice. There are more platforms to store your code, but GitHub suits my needs perfectly. It basically is a remote repository where you can store your code. But GitHub offers more. You get a basic ticket system, wiki and a nice way to view (and share, if your repository is public) your code online.

By sharing your code online, you also enable people to fork your code. By forking someones code, you basically create a new version of the repository, based on the current status of the code. You can then start modifying and using the code to your own liking. If you are looking to improve the main code, you can also issue a pull request to ask the owner of the repository to merge your code back in the main repository.

My WordPress plugins on GitHub

The past few months I have been moving all the WordPress plugins I am still actively developing, over to my GitHub profile. The repositories on GitHub are public and are the first who see every single bit of code I push in. Because the code is public and it contains the latest changes, everyone can contribute or respond to the code I work on. That is not really happening on the small plugins I own by myself, but we see it on a daily basis while working on the WooCommerce plugin on GitHub.

WordPress is SVN only

So we have Git and GitHub. But WordPress is using SVN for its main version control of the core code, the plugin repository and many more uses. How can we start working on WordPress plugins, while we are using Git for our day to day development?

First things first, it is not likely that WordPress will change its main version control system to anything other than SVN. The entire website and systems connected to it are build upon the SVN repositories. So we have to find out a way to use all the great features that Git brings and make that work with SVN repositories.

Because Git works with a local repository, you can use that repository for pretty much everything you like. You can convert Git commits and tags into SVN commits and tags, so in theory it is pretty simple to push those changes out to a SVN repository.

There are a couple of scripts available to do so:

You have to pick the way that suits you best. I have been doing it manually for quite some time, just copying the files from my GitHub repository into the SVN repository and then committing the stable releases to the plugin directory repository.

Pick the tools you like

I’m not saying you should no matter what use Git. My goal with this post was to show that there are alternatives available, that work pretty well along with SVN and the repositories. There are plenty of tools available to start working with Git, it is easy to learn and it proved to be worth it for me eventually.

Version control systems should work for you. If it is the other way around, you’re doing it wrong. Pick the right tools and make them work for you.