Git is a Version Control System. It is actually the world's most popular VCS.
What is a Version Control System?
A version control system is a tool that helps you track and manage the different versions of your projects.
You can compare, undo changes, track, combine to even the earliest versions. It is kind of like time travel. This system allows multiple collaborators to edit a project at once. Let's think of big tech giants like Google, Facebook, and Microsoft who have thousands of developers working on small snippets of a project in parallel. So a system must be in place to manage and combine every change. And Git is one of the systems that can help you in achieving that. Other well-known ones include SVN, Subversion, and Mercurial.
Why Git?
Now, you might be wondering, if there are more VC systems out there, then why Git? First of all, Git is almost used by everyone. According to the Stack Overflow 2022 Survey, almost 95% of all respondents use Git as their VCS. According to StackShare, around 8500 companies and more than 163,000 developers use Git.
Source: Stack Overflow 2022 Developer Survery
Secondly, GitHub, as pointed in the name, is centered around hosting Git repositories. While GitHub can host other VCS Projects, it's not ideal.
So, you don't need to think about choosing a VCS, just use Git!
What actually is Git and how is it helpful?
Well as I stated earlier, Git helps us track changes, see or revert back to older versions if we make mistakes, combine changes between files, versions, or even other collaborators, collaborate and share changes, and much much more.
For example, Have you ever played a game? If yes then you should know about an in-game 'Checkpoint System'. Let's say you grinded a game to get some valuable loot, now if you die all that loot will be gone. So, you can pass through a checkpoint, and now whenever you die the game will revert back to the checkpoint. This is a watered-down example of what Git is.
Another way you can think about is, let's imagine you're in university, and your teacher gave you an essay to write. You write your first draft, but now you have to edit that version, tweak a few things, and write your second draft. So, you make a copy of that file and start editing it there. Now, you continue to create a copy and make newer versions. This way you can compare them, combine snippets from older versions, and revert back to an older paragraph. And this is essentially what Git is at its core and what it is used for.
Let's look at a real life example!
Imagine, you're an employee and your boss assigned you to develop a website. You created a basic version of that website and made some changes to that with your boss's orders, each step of the way you remembered to add a checkpoint.
Now, you feel like maybe the website would look better and sleeker in a dark tone. So, you change the website to a dark tone and add a checkpoint.
You send it to your boss, and your boss is absolutely furious! Because you changed something without your boss's permission. No worries! Remember all the checkpoints you took? Just revert back to the one before dark mode. And Boom!
The boss just furiously wrote you an email. He doesn't like the empty space at the bottom. He told you to add another image there. Now, you don't want to delete your old dark mode code. But, you can just create another fork from the 'Add Information' checkpoint. And it won't affect your Dark Mode code.
Now, Your boss is starting to cool down a bit. You still want the website to be in dark mode. Fortunately, you can still go back to the 'Dark Mode' checkpoint any time you want. So you decide to go back to the other fork and send that to the boss.
Now, your boss has cooled down and come around to the fact that the website looks better in dark mode. He tells you to make the updated website in dark mode. And now, you can actually combine two forks together! No worries. So you combine them and send them to your boss. Your boss is happy. You are happy.
You can go back to any checkpoint you want, at any time! Even to the beginning.
This is a very laid-back example on how Git is used. But upscale it and think of a big tech company and the thousands of developers coding at the same time and how Git can help them to manage their projects! Different contributors work on a project simultaneously and just combine them at end. If a project has a massive exploit, the devs can just roll back to a few updates prior and fix the exploit and come back to the newer version. This is why Git is used across the board.
β
This was a simple and beginner's understanding of what Git is. I'm still a newbie, but I hope to go in-depth in the future. Thank you for taking your time and reading.
Top comments (2)
Indeed,it is really a nerve wracking task to write a behemoth passage like this.
Surely i witness that, author successfully accomplished all the parts regarding git.
Best of luck SD sadnana
Thanks!