What is Git?
Git is the most popular version control system in use today. It was developed in 2005 by the creator of Linux, Linus Torvalds, and today the majority of private and open-source software use Git for version control.
Due to its flexibility and robust feature set, Git has also become the default version control system across operating systems and cloud-computing platforms. Companies like AWS, Microsoft Azure and Google Cloud provide robust first-class support for Git within their tools.
Widespread Adoption
Git is as close to a universally-adopted technology as you'll find in the tech industry. No matter your career focus or preferred programming language, chances are Git will be part of your day-to-day workflow.
In fact, according to the 2022 StackOverflow Developer Survey of over 73,000 software developers from 180 countries around the world, "No other technology is as widely used as Git. Especially among Professional Developers." Over 96% of professional developers use Git, and when accounting for those learning to code still over 93% of all developers use it. [source].
How Git Works
Git allows each developer to keep an entire copy of the codebase and change history on their local computer. Git operations are then performed entirely locally. Developers then have robust capabilities to merge their local code changes with other collaborators through a remote server. This remote server can be created by the development team, or can be hosted by Git-based code hosting service like GitHub, GitLab or Bitbucket.
The Snapshot Model
Git saves snapshots of every file each time you save the state of your project. This makes Git "more like a mini filesystem" [source] where every previous version of a file is available in its entirety. Other version control systems just keep a log of the differences between file versions; however, Git's snapshotting model unlocks the main speed and performance benefits that we cover in the next section.
Benefits of Git
Now that we have a general idea of how Git works, let's talk about why it's so popular, and what sets it apart from other version control systems. Aside from Git's snapshotting model, which many developers subjectively prefer from a usability perspective, there are two general categories where Git benefits over other systems.
Speed & Performance
Git is truly a distributed version control system, and the majority of Git operations are performed locally. Branching, committing changes, diffing files, examining history, etc., are entirely based on local project history. Compared to other version control systems that require a remote server to retrieve project history, Git operations have a noticeable speed advantage. Considering Git's robust collaboration capabilities, the near instantaneous execution time of Git operations is a standout feature when compared to other distributed version control systems.
Aside from just execution time, Git's ability to performantly manage large projects and handle extensive concurrent development (think thousands of branches) are also unique standout features.
Integrity
Every time Git saves the state of your code, it hashes the contents using a modified version of an algorithm known as SHA1. This practice makes it impossible to update the contents of your codebase without Git knowing. This integrity is important when using Git to collaborate with others, and especially for open-source applications. It gives users a unique identifier to use to refer back to each saved state in the lifetime of the repository. All this happens behind the scenes.
Git vs GitHub
Especially for newer developers, the difference between Git and GitHub can be confusing. Git is a tool that allows you to control and monitor the history of source code, including tracking changes and managing versions. GitHub is a cloud-based service that hosts Git repositories, useful for open-source projects that utilize Git allowing many developers to collaborate on a Git repository efficiently.
In simpler terms, Git is the version control system, while GitHub is a cloud service that hosts source code. Other examples of public Git-based source code hosting services include GitLab and BitBucket. GitHub is by far the most popular, especially for open-source projects [source].
Developers can also use Git without a hosting service, and many prefer to host Git repositories on their own private servers. Azure Repos or AWS CodeCommit provide this type of service.