A little git cheatsheet

Programming Language Technology, DAT151/DIT231

Basics

Git overview

Picture 1:

Working dir    Git database   Remotes
-----------    ------------   -------
project/       project/.git   git@git.chalmers.se:user/project
- README                      https://github.com/joe/project
- File1
- Dir1/File2

Picture 2: a version tree

* - * - * - * - * main
    |           \ * - * - * develop
    * - * - * experiment

Commit identifiers: <commit>

Starting a git project

Remotes

Commits

Changes in the working directory are first added to the staging area (the index) and then bundled into a commit. Usally, this is done with GUI support.

Tags

Somewhat advanced

Branches

Default branch is often named master or main.

Pulling with conflicts

Merging

Undoing

There is also git stash, but you need to know what you are doing...

Managing remotes