ULG 971001 - Software (VU 2) - python, git, docker

What is a version control software

A Version Control Software (VCS) is, in its most abstract form, designed to keep track of changes to a file system. This means it tracks changes in files, such as addition or deletion, but also more basic modifications to files or directories. A VCS also allows teams to collaborate and therefore inform each other of changes made by others. Some of the main features of a VCS is that you can:

  1. Revert a file or an entire directory to a previous state.

  2. Compare files or directories to a previous version.

  3. Help resolving conflicts if multiple changes on the same resource collide with each other.

  4. Allows you to tag specific versions of a file for alter use.

  5. Keep track who changed what and when.

  6. Much more

In the scope of an entire file system this is used by operation systems to minimize file loss and allows users to restore unwanted changes. Most often, and that is also the main focus here, a VCS is used to track of source code. This might be a software project or a term paper. Nevertheless, the VCS will keep track of additions, deletions, modifications and so forth of individual lines of text within these files. We will focus on Git but there are alternatives around such as Mercurial, CVS, or SVN. All of them have individual strengths and weaknesses but in terms of wide spread use Git is in the lead.

What is git and a bit of history

Git was developed as a free and open source software by Linus Torvalds in 2005 for the development of the Linux kernel. The main goals in the development were (according to wikipedia):

  • Take Concurrent Versions System (CVS) as an example of what not to do; if in doubt, make the exact opposite decision.

  • Support a distributed, BitKeeper-like workflow.

  • Include very strong safeguards against corruption, either accidental or malicious.

The development of Git began on 3 April 2005. Torvalds announced the project on 6 April and became self-hosting the next day. The first merge of multiple branches took place on 18 April. Torvalds achieved his performance goals; on 29 April, the nascent Git was benchmarked recording patches to the Linux kernel tree at the rate of 6.7 patches per second. On 16 June, Git managed the kernel 2.6.12 release.

Regarding the name:

Torvalds sarcastically quipped about the name git (which means "unpleasant person" in British English slang): "I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'git'." The man page describes Git as "the stupid content tracker". The read-me file of the source code elaborates further:

"git" can mean anything, depending on your mood.

  • Random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant.

  • Stupid. Contemptible and despicable. Simple. Take your pick from the dictionary of slang.

"Global information tracker": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.

  • "Goddamn idiotic truckload of sh*t": when it breaks.

In the following we try to give a pragmatic hands on introduction to the concepts of git and how it can be uses. The notes are a mix of several sources but the main ideas are based on the git training by the UnseenWizzard.

This part covers the following sections:

  1. Getting started with the basics

Installing Git on your system

Linux

  1. Open the terminal

  2. Type git --version

  3. If Git is not installed use your package manager to install it (Ubuntu: apt, Fedora dnf, ...) with sudo apt install git

OSx

  1. Open the terminal

  2. Type git --version

  3. If Git is not installed install it via xcode-select --install

Windows

  1. Download Git von https://git-scm.com/ and install it with the default settings (unless you really, really know what you are doing).

  2. Open the git bash and verify the installation by typing git --version

In the following we will always refer to the Terminal, by which we mean the Git Bash on Windows and the Terminal on Linux or Macs.
Check your installation with the above guide. Check that you can log into the git service of the University.

Specify these global variables in the Git Bash on Windows or the Terminal:

git config --global user.name "Your Name"
git config --global user.email "Your University Email"

Additional resources

Obviously not everybody learns the same way and the concepts of Git can make your brain twist a bit so here are some additional resources:

CC BY-NC-SA 4.0 Peter Kandolf. Last modified: January 19, 2024. Website built with Franklin.jl and the Julia programming language.