Git & GitHub: What is Git? | #1
Tags: git, github, beginners, versioncontrolsystem
Published: 2023-01-07 07:47:54

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](https://stackshare.io/git), around 8500 companies and more than 163,000 developers use Git.

![Stack Overflow 2022 VCS Survey](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l0au7rtcuvju5yncrr3k.png)
###### [Source: Stack Overflow 2022 Developer Survery](https://survey.stackoverflow.co/2022/#version-control-version-control-system)

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.

![Different iterations for an Assignment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpulmfifa2pmnnaopgku.png)
##### 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.

![Your Basic Website](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/milktdtqilmcby898f5d.png)

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.
![Dark Mode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eursfn0fbtch7es9vrd6.png)

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!
![Revert](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgc8l90imzw35huwmul5.png)

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.
![Footer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1wmvtl07m68ejjfp8bn.png)

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.
![Moving through Forks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/srwoqgbhkrp9kzhkc72h.png)

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.
![Final](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vqnkeismpxh3ii401g6.png)


###### 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.