“Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance.” (Git)
But first thing first : what is a “version control system”, and why should we care?
A version control system (VCS) tracks changes to files. As we modify files, the system records and saves each change within an history. This allows to restore a previous version of your code at any time. Using a VCS also generally means that if we screw things up or lose files, we can easily recover to any checkpoint.
In a collaborative environment, it is common for several developers to share and work on the same source code. While some developers will be fixing bugs, others will be implementing new features, etc. Git is the standard system used to manage all of this.
In short, a version control system like Git is essential for all kind of programming and software development. It makes it easy to: - Keep track of code history - See which changes were made - See why were changes made - See who made which changes - Collaborate on code as a team - Deploy to staging or production
We will learn here Git from essentials like repositories, branches, commits, and Pull Requests to more advanced topics such as workflow, statistics, automatic build integration and how to collaborate with other developers.
What if I don’t use it?
I am sure any of us has already been doing some file renaming to keep track of different versions, as for instance : “resume”, “resume_v2”, “resume_062018”…
In other words, any of us has already been stuck to manually save multiple versions of files using different names. Renaming a file also doesn't give us any context as to what changes were made or who they were made by. When multiple team members edit the same file, overwriting occurs and it starts being impossible to keep up with the latest file version.
This problem already occurs for a unique file. I let you imagine how messy it can be with thousands of them.
Why using Git in particular?
The very short answer would be : Git is the most widely used version control system in the world and is considered the modern standard for software development.
Unlike older centralized version control systems such as SVN and CVS, Git is distributed: every developer has the full history of their code repository locally. Thus, if any server dies, and these systems were collaborating via that server, any of the client repositories can be copied back up to the server to restore it. Every clone is really a full backup of all the data.
Git also has excellent support for branching, merging, and rewriting repository history, which has lead to many innovative and powerful workflows and tools. Pull requests are one such popular tool that allow teams to collaborate on Git branches and efficiently review each others code.
Great, since we know for what and why we are using Git. Let's get started!