Skip to content

Introduction to Version Control, Git, and GitHub

This article will cover:
- Version control and Git
- Distributed version control and GitHub

Version Control and Git

Version control systems are responsible for tracking changes to a given set of files, allowing users to freely edit files without creating numerous copies to preserve every iteration of each file.
Version control systems also provide an avenue for recovering files if their up-to-date versions are deleted or corrupted.
Note that these systems are completely local, that is the tracked files are only available on the system which they are created on.

Though it is far from the only one, Git is one such version control system.
With Git, users can add files to start tracking changes, and commit changes to various files to register them.
Once a file has been added and has one or more changes users can freely view prior versions of each file.
Git does have GUIs (i.e., desktop applications) available, but its Command Line Interface (CLI) application is more widely used, either at a Linux-like command line or on its own dedicated CLI.

Distributed Version Control and GitHub

Distributed Version Control systems add the capability for tracked files to be shared among several users, allowing project files to be shared among groups while preserving the other capabilities of version control systems.
Because multiple users now need access to project files, the repository can no longer stay local to one user.
Instead, these systems use a remote copy of the tracked files which can be copied to and from users' local repositories.
Under this model users have the additional responsibility of keeping the remote repository up-to-date with their local changes for their teammates.

Allowing concurrent access to project files presents another issue: conflicts.
Consider the following example:
- Alex pushes updates to section 1 of a file
- Brittany is working on an update that also touches section 1
- Brittany pulls down updates (including Alex's)

In this situation, Brittany has created a conflict because both her and Alex have modified section 1. She must resolve it using the tools the version control system provides.
Later articles cover resolution of merge conflicts with GitHub.

GitHub uses the Git CLI for all local operations, and adds a web interface as well as CLI commands for synchronizing local and remote repositories. GitLab is another web-based interface that uses the Git CLI but is oriented for self-hosting (e.g., the national laboratories host their own internal private GitLab instances).