7 · Projects & git

Tuesday, Sep 15, 2026

Materials for this session are not published yet. They appear here before class.

Objectives

By the end of this session you can:

  • Lay out a project: where code lives, where data lives, where output goes.
  • Use relative paths so the project runs from any machine, and symlinks for data too large to copy.
  • Explain what a repository and a commit are, and what problem they solve.
  • Clone, stage, commit, and push from your own machine.
  • Read a diff before committing it.
  • Undo a mistake at each stage: discard an edit, unstage a file, amend the last commit.

What we cover

  • The canonical project layout: code, data, and output in separate folders; raw data never edited in place; scripts numbered in pipeline order (1_download, 2_process, 3_plot).
  • Paths that work everywhere: relative paths from the project root; symlinks for large data kept outside the project.
  • Scripts create folders, hands don’t: list.files() recursively, dir.create(), unlink(), zip archives in and out.
  • The reveal: you have been committing through the browser for three weeks — here is what that meant.
  • Clone / stage / commit / push / pull. One interface demonstrated in the room; this page shows each step three ways — RStudio git pane, VS Code, and the terminal — pick the one that fits how you work.
  • Undoing things: discard, unstage, amend — and the one warning that prevents real grief: never keep a repository inside Dropbox or any syncing folder.
  • Reading your own diff.
  • A first look at branches and pull requests — what they are for, and when a solo project needs them (rarely, but knowingly).
  • From here on, homework flows through git proper.

Verification habit. Read your own diff before every commit.