What better topic for my first post than my favorite piece of software? This post is intended for the budding programmer who is ready to take his or her productivity to the next level. Git is one of the best ways to do just that.
Git has many features and a comprehensive review of any one of them is far beyond the scope of this post. Instead, we will cover the basic idea behind Git and why you should use it if you don’t already.
What is Git?
Git is a distributed source code version control system. It keeps track of the revision (change) history for your code, recording snapshots of your codebase’s history while you work. It is also a powerful tool for collaborating with other developers on a project. If you’ve never used Git before, you might think that you don’t need it—we’ll get to that in the next section.
Why use Git?
These are my top reasons to use Git:
- Increased productivity
- Better collaboration
- Automatic redundancy
1. Increased Productivity
Have you ever been writing a program and realized that you broke something that worked previously, but have no idea how many changes you have made since it stopped working? You then begin a frantic series of undos in hopes to get your program back to a working state. (And if you’re lucky enough to find one, you have to redevelop the progress you just undid.)
There’s a better way.
With Git, you periodically commit your program as you develop. That way, when you’ve made some progress, you can commit your code and then move forward knowing that if something goes wrong you can always safely revert to a previous state. You can even delete files and Git will re-add them if you tell it to.
2. Better Collaboration
Git is the go-to standard for collaborative coding. Often there will be a designated server to host a Git repository that developers of a team will pull from and push to. Git makes it easy to develop different features simultaneously and even merge conflicts where necessary. One of the most popular hosted Git solutions is GitHub, which has a special focus on highly collaborative, open-source software.
3. Automatic Redundancy
One significant advantage of Git is that if your team’s central Git server were to go down, each computer that cloned the repository has a full backup of the code including all of its history. Team members could then push and pull code from each other until the issue with the server could be resolved. This is not possible with some other version control systems.
Git is a powerful tool to add to your toolkit. Learning it is an investment that is sure to pay off.
There is a great (free!) book about Git called Pro Git which gives a thorough explanation of Git usage for all experience levels. It’s available in various formats and languages. I would recommend going there next!