Why is Git relevant to WordPress developers? That question is what we try to answer in this lesson. Many WordPress projects are quite simple, but even for a simple project, Git can really improve and speed up the development process.
In this video I want to talk about WordPress developers should learn Git, and really most of what I'm gonna say doesn't really apply only to WordPress developers, but just developers in general.
First of all the most obvious reason to use Git, is that it allows you to undo stuff in an easier way, but actually there's a lot more to it. One of the most important things is of course teamwork. It allows you to work in teams. So if you're using Git, each team member can work on different features, they can collaborate on the same features, they can see who changed what, and they can also blame each other because they, all of sudden then can prove who added the line of code to index.php in 2011, or whatever.
Even if you're not working in a team, using Git gives you a lot of control. You've probably been in the situation where you had a WordPress plugin or WordPress theme, and you were working on some kind of feature on it, and then someone finds a bug that you need to fix immediately. So what do you do, do you remove the stuff you already added, or do you just keep it in there, while you make the bug fix. If you are using Git you could just have the new feature on its own branch, and then you could just fix the bug on the master branch, and you wouldn't have to really deal with the conflicts between the bug fix, and the new stuff you're working on that's not really done yet, and ready to be released.
Then of course, if you're using Git, it's really easy to have a backup of your code because you can basically just push it to GitHub, or Bitbucket, or GitLab, or one of the other hosted Git repository services that's out there.
Lastly it makes deployments a lot easier. You can set up automated deployments, so whenever you release a new feature and you tag it in Git, it can be released to your clients servers or the users of your plugin. That is what my plugin WP Pusher does. In the WordPress world SVN has been dominating for a long time, mainly because the WordPress.org repository uses SVN, and I wouldn't be too surprised if WordPress.org slowly starts moving closer to Git. I think at the moment you can already contribute to WordPress on GitHub, and the new release of Calypso is also on GitHub. So a lot of stuff is going onto GitHub right now, and if you don't already know Git, it's definitely the time now. So that's all 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