Every WordPress developer that have code in the official WordPress plugin or theme directories have encountered Subversion (SVN) - Git’s old cousin. In this lesson we dive into the differences between the two version control systems. I hope that after going through this lesson you will realise that Git is probably what you need for your next project.
In this video we're going to talk briefly about the differences between Git and Subversion - or SVN.
This is an article I wrote on the WP Pusher Blog, called "Demystifying Git for WordPress Developers." It talks about some of the differences between Git and Subversion, and I thought I'd just quickly go through them here. If you want to read the article you can find it on blog.wppusher.com.
So if we scroll down a bit here. This is the first and probably the most important part here. So compared to Subversion, Git is highly decentralized. When you create a Git repository it's just stored locally on your computer, and it's not required that you push it to a server, like GitHub, or your own hosted Git server or anything like that. With Subversion, you need a central server, which is going to host your repository. A Git repository is basically just a bunch of files on your own server. So Git is decentralized and even if you push your repository to something like GitHub when someone else clones that repository, they get the full repository, they get everything. So it's completely decentralized, there's no need for some central host.
Another difference is that Git is extremely lightweight and one of the main reasons it's so lightweight is because there's no network latency because you don't have to commit changes to a central server. Also, just in its internal workings Git is a lot faster, the way it stores snapshots of the changes you're making, it's very different from Subversion.
Then the third part here is that Git is not Subversion. So some of the terminology that's used in the two different tools sound similar but they actually mean different things.
So one of them here is the term repository. In SVN a repository refers to this central location on a server that everyone can check out and commit stuff to etc. whereas in Git it's just a hidden folder on your local computer.
Then there's the concept of checking out code. In Git checking out means that you switch to a different reference. That could be a branch, or a commit, or a tag, or something like that. You switch to another snapshot basically. In SVN it means that you download a part of the code to your local machine, so you can work on it, and then you can push it back to the server. Checking out from a SVN repository is very similar to the concept of cloning a Git repository, like you can clone a Git repository from GitHub.
Then there's the concept of a branch. In Git, it's pretty literally a branch of the working tree. So you have the full history, you can go back from the branch and all the way back to the root, so to say. You have everything, all changes and everything. Whatever branch you're on decides what code you see in the working directory that you're in. Whereas in SVN a branch is sort of a copy of the code in the branches folder, so you can work on it there, and then when it's ready to be merged, it's gonna be moved back in the trunk folder.
So the concepts there are a little different, but all in all I think if you know Subversion already, it's gonna be pretty easy for you to learn Git.
That's it for this video. Thanks for watching.
Take the pain out of WordPress development. Manage your code with Git and never again deploy files over FTP.
When I came across WP Pusher, I knew I had found the answer and it's now a vital part of our workflow!
Ashley Hart, Green Chilli
GitHub user, runs his local WordPress agency with WP Pusher
WP Pusher makes deploying changes to our websites quick and easy. We could not manage without it.
Simon Appleby, Bookswarm
Bitbucket user, manages 100+ WordPress sites with WP Pusher