If you have downloaded free and open source software, you’ve probably heard of a site called GitHub. Maybe your CMS software is hosted there. But what is “Git” and why is it popular and why should you use it, even on small sites?
Understanding Git
What is Git? To put it simply, Git is a version control system. A version control system allows software developers to work on teams and work on code of a project together. Teams of all sizes use it, from single developers to teams of hundreds of thousands. The best thing about Git is that it is distributed. Every developer on the team has a copy of the different repositories. They make the changes local on their system and then push these up to the Git server and into the appropriate branch. Another great reason to use Git is that it is free and open source software. Since it’s open source, it has been ported into most IDEs (like Visual Studio) and is supported on every platform – Windows, Mac, and Linux.
Using Git
Git is installed on your computer or your development machine. From here, you checkout code from the repository, make a branch, and get to work. You do all your work in your branch. You then push your branch up to allow others to work on it as well. No matter if you’re cranking out PHP, JavaScript, C#, or even HTML, using Git can save you a lot of headache!
If you’re looking for a great Git tutorial to get you up and running, we highly suggest checking out this guide from Atlassian to get you started.
Why you should use version control on your website
Your website is a living application. You’re going to make changes to it, maybe you want to bring a developer on, maybe you even want historical records of your site. Git makes this all easy! Having different branches means you can work on different portions of your site and then merge them together when it’s all done.
Hosting your Git repo
Although Git is decentralized, it is centralized in a way. You need to connect to a Git server to store your code. A popular one is GitHub. It’s free and it allows you to create unlimited public repos (this means that anyone can access it, great for open source projects not so great for proprietary code). If you need private repos (like authorized team members can access the repo with their login), this is where GitHub will cost you. If you’re on a limited budget, or want to use a different service, we recommend GitLab. Xinsto, our parent company, uses GitLab for some of our internal software projects and it’s our favourite especially because you can have private repos for free.
Publishing your site with Git
This is where it gets cool – you can actually publish your site using a combination of shell scripting and Git (and yes, NodeSpace supports this with our Elite plan and on all dedicated and virtual servers!). There are various instructions on how to do this all over the internet. Due to this being advanced, our support team is unable to “officially” support it, however we will gladly help you!