Git is an essential tool for all developers! It is simply the only tool commonly used by all developers.
Anyone aspiring to become a developer will inevitably encounter Git at some point, so it's best to understand how it works and what it is!
If you've already heard of Git but are not entirely sure what it is or how it works, this article is here to enlighten you. π
Table of Contents
1. What is Git? π€¨
2. Why is Git so Popular?
3. The Basics of Git πΏ
4. Collaboration with Git π€
5. Essential Git Commands π οΈ
6. Advantages and Disadvantages of Git
7. FAQ on Git π
Β
What is Git? π€¨
Git was created by Linus Torvalds, a famous developer who is the originator of the Linux operating system, precisely in 2005.
He wanted to be able to control the versions of his operating system, which is why he developed Git.
The idea of Git is simple: to create a version control system that allows collaboration with a team, where each collaborator can have their own copy of the project (known as a repository).
Git should not be confused with GitHub, which is an online platform based on Git. We will come back to this later.
Git is thus software that you install on your computer to create different versions of your project: v1.0, v2.0, v3.0, etc.
Β
Why is Git so Popular?
One of the reasons Git is so widely adopted is its flexibility and reliability. Git allows developers to:
- Work on multiple versions of a project in parallel;
- Revert to a previous version in the blink of an eye;
- Collaborate effectively by ensuring everyone is working on the correct version.
It is also open-source, which means anyone can use it for free and contribute to it.
Β
The Basics of Git πΏ
To understand how Git works, here are some concepts to grasp:
- Repositories (also called repository πΊπΈ): This is a folder that Git uses to store information about the changes made to a project;
- Commits: Every change saved with Git creates a commit. It is simply a small save point that allows you to return to the state of your code with a single click;
- Branches: There can be an infinite number of branches. Like a tree, branches are all attached to a trunk (the repository). But each branch is like the multiverse, a parallel reality where each can work on a different feature and then merge their version and changes with the main project code.
Branches are one of Git's most powerful features because they allow collaboration without risking that the modifications from one team member will destroy your own modifications.
For example, if you're working on a new feature, you can create a specific branch for it. This way, you can test ideas without risking breaking something in the main version.
Once you've finished your work on a branch, you can merge it with the main branch.
Β
Collaboration with Git π€
Working as a team on a Git project is very simple. Each team member can clone the project and work on it independently. The changes made by each member can then be shared and merged using tools like GitHub or GitLab.
Collaboration often happens in three steps:
- Clone the project;
- Create a branch to make your modifications;
- Push (push πΊπΈ) your changes to the main repository so everyone can see them.
Β
Essential Git Commands π οΈ
To understand how Git works, it's important to understand how to use it.
Git is used through a command-line interface (well, let's call it the terminal).
In this terminal, we can use numerous commands to interact with Git.
Here are some of them.
To Initialize a New Repository
git initΒ
To Clone an Existing Repository
git clone [REPOSITORY URL]Β
To Tell Git to Track a File
git add [file / folder]Β
To Save Changes
git commit -m "[message"]Β
To Retrieve Changes from a Remote Repository
git pullΒ
To Push Your Changes to a Remote Repository
git pushΒ
So, not so complicated, right? π
Rest assured, generally you need to take a good Git training to understand how to use it.
Β
Advantages and Disadvantages of Git
Being the most used tool in the world by developers, Git is not without its flaws either. But let's start with its advantages:
- Git is reliable - It allows you to have thousands of versions without ever corrupting data;
- Git is great for collaboration - It's no wonder that 99% of companies use it;
- Git is open-source - So it's free and continuously improved by thousands of developers.
Now, let's also look at its disadvantages:
- Git is hard to master - It can seem confusing for a new Git user. You need to use the terminal and understand how commands can work. But generally, taking a good training (like ours) allows you to master Git in a short week.
- Git is complex - To work with Git on huge projects, in the best case scenario, you would need thousands of branches, which can quickly become complicated over time.
Β
FAQ on Git
Our learners often ask us questions about Git in our training, here's a small selection of the most interesting questions! π§
Is Git only for developers?
No, Git is primarily used in development, but it can also be used to manage versions of any type of file, such as documents or your own journals.
Β
What is the difference between Git and SVN?
Git is distributed, which means each user has a complete copy of the project. SVN is centralized, where everyone works directly on the central server.
Β
Is it necessary to know Git to be a good developer?
Yes and no. While it's not always mandatory, Git has become an industry standard, so knowing it is an essential asset.
Β
How to learn Git quickly?
By taking a good training!







