Introduction to version control with Git - Why we want to track versions and how to go back in time to a working version

Warning

In February and March 2024 we rewrote this lesson from the ground up. If you are looking for the previous version, you can browse the 2023 version of this lesson.

This is the introductory lesson to version control using Git.

We start with an existing repository on the web to visually explain the basic concepts of version control. We later move to a local repository. Our goal there is not only to be able to apply changes to an existing repository but to also be able to turn own projects into Git repositories and to share them with others.

In the separate collaborative Git lesson, we teach more use of remote repositories and good collaborative workflows. We try to stick to simple workflows, just enough for researchers who are not obsessed with Git to be able to work well.

The goals of the module as a whole are that the learner will feel comfortable about committing changes, branching, and merging.

Prerequisites

We offer several options to go through the material: on the web, in an editor, or in the terminal. Please see the installation instructions.

We recommend to have a GitHub account. Why GitHub? Also GitLab and Bitbucket would allow similar workflows and basically everything that we will discuss is transferable. With this material and these exercises we do not implicitly endorse the company GitHub. We have chosen to demonstrate a number of concepts using examples with GitHub because it is currently the most popular web platform for hosting Git repositories and the chance is high that you will interact with GitHub-based repositories even if you choose to host your Git repository on another service.

Studying an existing project