A Beginners Introduction to Git

A Beginners Introduction to Git

Understand the basics of Version Control Systems and Git and why you should use them.

Hello everyone! Welcome back to another article. Hope you all are doing great and having an incredibly productive week. In this article, I would like to give you all an essential introduction to the most popular version control system, Git.

And I'm also hoping to create a new series around learning Git, so stay tuned for that also. Okay, so without any further ado let's get started.

Version Control Systems (VCSs)

I have everthing under control

Before we move on to learning about Git, we should first try to have a good understanding of what a version control system is.

What is a Version Control System?

A Version Control System or a VSC for short is a software tool that helps to record and manage changes to your source code over time. This means that these tools keep track of every modification that happens to the code by taking snapshots of all these changes and storing these changes in a "special database", to make it easy for you to manage your codebase (i.e. if you want to roll back changes to previous versions or to create separate workspaces(branches) to avoid conflicts between new and old code, etc..).

Why do we need a Version Control System?

Every developer, including myself, treats the source code of a project as a precious asset that must be protected at all times. Software developers use Version Control Systems to protect and manage this precious asset from specific challenges they might face during the development, production and maintenance of the source code.

Some of the situations where using a VCS can help us:

  • When collaborating as a team / contributing
  • Keep backups of your codebase
  • Have a history of changes you made so that you can easily revert to those changes
  • Change a copy of your work without affecting the main codebase (i.e. If you want to experiment)

Types of Version Control Systems

There are primarily 3 types of Version Control Systems. They are:

  • Local Version Control Systems
  • Centralized Version Control Systems
  • Distributed Version Control Systems

Each has its advantages, disadvantages and use cases. I'm not going to dive deeper into that in this article, but I have listed a few resources that might help you understand each of these types of VCSs:

Git

Git Giphy

Git is an Open Source Distributed Version Control System developed by the creator of Linux, Linus Torvalds in 2005. Git is by far the most popular and widely used version control system in the world. The 2022 StackOverflow Developer Survey proves that more than 93% of developers use Git as their Version Control System and has become the universal standard of VCSs.

What makes Git stand out?

Here are some features of Git that make it the easiest and the go-to VCS:

  • It's Distributed - this means that instead of switching the project to another machine, we can create a "clone" of the entire repository.
  • It's Secure - Git uses the SHA1 (Secure Hash Function) to name and identify objects within its repository
  • It's Scalable - Got 100 devs joining to work on a single project, no problem Git can handle such situations.
  • It's Fast - Most of the git operations are done on the local repository, so it provides a huge speed. A Performance test conducted by Mozilla showed that it was extremely fast compared to other VCSs.
  • It's Open-Source - Git is free and open-source under the GPL (General Public License) license.
  • Staging Area, Branching, Merging(The Git Workflow) - Some unique features of Git that makes it different and powerful compared to other VCSs.

Why should I use Git?

In the previous section, we discussed the features and benefits of Git. Now let's talk about some other points about why you should use Git.

Work Offline - Since everything in Git can be performed locally, you will not have to ensure your internet connectivity. This gives you a lot of flexibility when it comes to where or when to work, thus giving you the full remote experience.

A Large Community - The fact that Git is the most popular VSC in the world means that there is a very large number of developers working on it. Trying to improve it, reporting bugs, fixing bugs and helping newly joined developers learn and resolve their issues. Since the user base of Git is so large, there will be another developer who had the same problem as you or can help you overcome the issue.

It's The Trend - If you ever plan on contributing to opensource or even work as part of a team, you will need to use Git at some point in your programming journey. Why wait till that moment comes? Start right away to use Git with your personal workflow and you won't regret even a bit about using it.

Conclusion

That's it for this article and thanks for reading! Hope you find this article to be useful. And like I said, this is a part of the Fundamentals of Git series, where I hope to go in depth on topics about Git and it's workflow. I'm also happy to say that this is the third article of the #2Articles1Week challenge. If you want to learn more about this check out this article.

And as always, if you have any questions or feedback let me know in the comments down below and follow me on Twitter for more updates on my journey, tips and tricks about programming. See you on another article this week! Ta-ta 👋