15 Oct What is Git, and how to use it?
If you make websites, or if you even if you simply are writing an email or essay, we’ve all been there. We’ve changed a line of code or text, or deleted it only to find it was a vital cog to what we were doing. Or worse, we’ve deleted whole paragraphs, and saved our document, which again means everything is lost. It is a frustrating feeling we’ve all had at some point.
But wait, what has this to do with Git? Git is an Open Source Distributed Version Control System. That’s a lot of words that probably don’t mean a whole pile, so lets look at that that means:
- Control System: This basically means that Git is a content tracker. So Git can be used to store content — it is mostly used to store code due to the other features it provides.
- Version Control System: The code which is stored in Git keeps changing as more code is added. Also, many developers can add code in parallel. So Version Control System helps in handling this by maintaining a history of what changes have happened. Also, Git provides features like branches and merges, which I will be covering later.
- Distributed Version Control System: Git has a remote repository which is stored in a server and a local repository which is stored in the computer of each developer. This means that the code is not just stored in a central server, but the full copy of the code is present in all the developers’ computers. Git is a Distributed Version Control System since the code is present in every developer’s computer. I will explain the concept of remote and local repositories later in this article.
Why do we need Git?
If like me, you are developing a few websites, and want to move to the next level, you really need to have version control. If you edit a config file, and the whole site goes down, it is a real lifesaver. Version control is vital.
At times, we may need to call in colleagues to help with a project. To be honest, most big projects generally have multiple developers working in parallel. So a version control system like Git is needed to ensure there are no code conflicts between the developers.
Additionally, the requirements in such projects change often. So a version control system allows developers to revert and go back to an older version of the code.
Finally, sometimes several projects which are being run in parallel involve the same codebase. In such a case, the concept of branching in Git is very important.
So what next?
We are going to write a few more blogs over the next couple of weeks which cover the Git basics. We will also be cross referencing other articles, blogs, and websites to hopefully give you everything you need to know to get started!