What is Git?
First and foremost, Git is a Version Control System (VCS). That is, it is something that tracks changes in files (or directory structures) incrementally. The files (and directories) that get tracked are contained in a repository, and each change that you commit to the repository gets saved, allowing you to go back to a previous state of the files in your repository. This is the basic definition of a VCS.
Git, specifically, is a distributed VCS, as opposed to a centralized VCS. What the difference? A centralized VCS is typified by a single, central server that hosts your repository. With a centralized VCS, changes made by one person on their personal computer (for example) must be pushed to the central server in order to be saved in the repository. Hence, there is always one, and only one, true repository, which is sitting on the server.
Distributed VCSes, on the other hand, don’t have a central server. That means, as in the case of Git, that changes made by one person on their personal computer get saved to their own copy of the “true” repository. …But then which repository is the “true” repository? If there are multiple copies of the same repository floating around the interwebs, which one is the one that can be trusted? Well… They all can be trusted, because each copy of the repository is a self-consistent, stand-alone repository in its own right. And you can always bring multiple copies of the same repository together by merging them.
We’ll talk a little about what is Git and how to use it in the following examples. I encourage you to walk through these steps on your own.
Note: If you want to do the following on your laptop, you probably need to install Git. You can do that here.
If you want to do the following on Cheyenne, you will need to load the git
module:
module load git