Reordering Git Areas

Screenshot

We suggest rearranging the order in which the Git areas are introduced, starting with branching, and proceeding with committing and collaborating. In the following, we summarize how contents may be introduced in each area.


Teaching notes for branching

  • Start with commits, explaining that they contain a snapshot of the whole project directory, illustrate commit-shas, meta-data (commit message, author/committer, date), and the Git object store
  • Continue with predecessor links (no predecessor, one, many), developing the first version of a Git graph
  • Introduce Git commands: git commit
  • Explain the concept of HEAD and branch pointers
  • Introduce Git commands: git branch, git switch, git merge
  • Explain how rewriting history changes commit-shas and all following commits

Note: Different options may be possible, e.g., git branch/git switch/git checkout -b (plumbing and porcelain)


Teaching notes for committing

  • Illustrate the three areas: working directory, staging area, and git repository
  • Highlight why it is useful to have these three areas, and the staging area, in particular
  • Introduce operations to move file changes across areas (git add, git commit, git restore, git reset)
  • Clarify the possibility that a file is (changed) in multiple areas simultaneously (partial add)
  • TBD: git add rm / gitignore

Note: Different terms are used for staging area (index) etc.


Teaching notes for collaborating

  • Introduce local and remote repositories (upstream, origin, fork with/out permissions to write)
  • Explain push/pull/fetch and tracking of branches
  • Illustrate the role of pull requests (technically and why they are useful in practice)

Materials

Access slides in the browser, as a PDF, or pptx

Slides