Course plan

Materials for the instructors (scripts and exercises) can be found from: https://github.com/hpc2n/intro-git

Lectures and exercises (modules?)

  1. Setup (markdown, slides) - Birgitte
    • Everyone:
      • Installs Git
      • Creates a repository with git init
      • Sets their name and email with git config (local, global, system)
      • Creates a file
      • Adds the file with git add
      • Commits the file with git commit
    • Everyone
      • Clones the course materials
      • Everyone should now have functioning Git installation
      • Do this on kebnekaise only if people do not have a functional git on their own computer
  2. Motivation (markdown, slides) - Mirko
    • In HPC in particular (batch files, certain type of results, etc)
    • Exercises: None?
  3. Basic concepts (markdown, slides) - Mirko
    • Blobs
      • Content-based addressing
      • Files
    • Trees
      • Directory tree
      • Working tree
      • Commit tree
    • Commits
      • Author, committer, …
    • References (Refs)
      • Simple, symbolic
      • Tags?
    • Exercises: None?
  4. Basics commands (markdown, slides) - Pedro
    • Different ways to create and clone a repository
    • Adding files
      • Whole file, changes to a file, partial
    • Working tree, index / staging area
    • Staging and un-staging
    • Renaming, deleting
    • Committing
    • .gitignore
    • Exercises:
      • Create a repo, create a file, stage the file, commit (repeat with knowledge)
      • Partial staging
      • Move files around and commit
      • Several hands-ons so that people understand the difference between the working tree, the index / staging area, the commit tree and the stash). People should really get this.
  5. Commits (markdown, slides) - Mirko
    • History / log
    • Tags
    • HEAD
    • Navigation (~, ^, .., etc)
    • Diffs
    • Reset
    • Discarding commits
    • Changing commits
    • Amend, revert, …
    • Recovering the head
    • Stash (with keep-index as a part of a recommended workflow (p. 55))
    • Rebasing? (Might be too advanced topic)
    • Bisect
      • This could really sell the idea to some!
    • Exercises:
      • Modify a repository in two different ways, create two commits, Should use git stash keep-index.
  6. Branches (markdown, slides) - Birgitte?
    • Why use branches?
    • Basics concepts
    • Creation, deletion
    • Switching (uncommitted changes etc)
    • Visualization
    • Uncommitted changes…
      • Stashing, discarding
    • Conflicts
      • Rebasing
      • Merging strategies
    • Cherry picking
    • Exercises:
      • internal-examples/discard-local-changes
        • Requirements: git pull, git diff HEAD origin/master, git stash *, git reset hard HEAD~, git checkout file.txt
        • Idea: Repeated exercise first with a local branch and then with a remote branch? One as an example, one as an exercise?
  7. Working with remotes (markdown, slides) - Pedro
    • Basics concepts
    • Pull, push, fetch
    • Tracking
    • Several remotes?
    • Using GitHub
      • ssh keys
    • Good “manners”
      • When to use revert, rebasing, etc
    • Exercises:
      • internal-examples/merge-rebase
        • Requirements: git status, git diff, git add, git commit, git push, git pull, git log, git reset hard HEAD~, pull rebase
      • Rebasing small commits into larger ones and pushing them to remote(
  8. Teamwork (markdown, slides) - All
    • Work in small teams?

Advanced topics

  • Tags / Releases
  • GitLab, GitHub

These should go somewhere:

  • Other stuff
  • Git on Windows. git-scm.com etc.
  • GitLab, Github, Bitbucket webpages. How to use them. Keys and key security issues.
  • Graphical interfaces to Git, tools for Git (Git kraken, )

Preliminary schedule

(Should be broken into four half-days for 2021)

Time Description
09:00 0. Introduction and setup
09:30 1. Why use version management?
09:55 Break (5 min)
10:00 2. Basic concepts
10:55 Break (5 min)
11:00 3. Basic commands
12:00 Lunch break (60 min)
13:00 4. Traversing the commit tree
13:55 Break (5 min)
14:00 5. Branches, merges and conflicts
15:00 Coffee break (30 min)
15:30 6. Working with remotes
16:25 Break (5 min)
16:30 7. Teamwork
17:30 End of the course