A half-day course providing an introduction to the Git version control system.
Git is an open source version control system for tracking changes in code and other types of text documents. First released in 2005, Git has become the de-facto standard for version control, and is extensively used in both open source and commercial software development.
Git is not limited to software development, and has proved to be an essential tool in reproducible research - allowing to keep track of files such as data analysis scripts, pipelines, reports or more generally any text-based document.
This half-day course gives a short introduction to Git and its most useful
commands, as well as an introduction to collaborative workflows using GitHub
through both theory and practical exercises.
Specifically, the course will cover the following topics:
- Brief introduction to version control systems: Git use case examples.
- Git basics: creating a Git repository and making commits.
- Git branches: basic commands to work with branches and introduction to branched workflows.
- Working with remotes: collaborating with GitHub.
- Collaborative workflows.
Please note that this course focuses exclusively on using Git via command line. This knowledge is then easily transferrable to any GUI environment (e.g. VS Code, RStudio, etc.).
Details on which Git commands are covered in this course can be found below.
Because of its limited in-class time (0.5 days), this course requires participants to to self-study before and after the class.
Specifically, this course is structured as follows:
- Pre-course self-study tasks (0.5 days):
- In-class teaching (0.5 days):
- Post-course exercises: a series of exercises to do on your own after the class.
You will find all the details to the pre- and post-course tasks in the sections below.
Given the limited in-class teaching time that is available for this course (0.5 days), participants are asked to prepare for the course ahead of time.
Please go through the following material before the start of the course:
- Setup your environment (~1h)
- Self-study the basics of Git and version control (~2h).
- Take this step-by-step tutorial of basic Git commands (~1h).
During the in-class part of the course, the following topic will be covered:
-
Git Basics
- Creating a new Git repo (
git clone
,git init
) - git add / git commit
- git status / git log
- Creating a new Git repo (
-
Branch management in Git
- What are branches and when to use them.
- Create and delete branches (
git branch
). - Reconcile branches (
git merge
). - Examples of branched workflows.
-
Working with remotes:
git push
/git pull
(skipgit fetch
?)
- Exercises...