A short course · 12 lessons in two parts · about 15 minutes each

GitHub Branches for Agentic Coding

For data science students who can commit and push, and now want to let Claude Code work on their code without risking main.

An AI coding agent can change a dozen files in a minute. Branches give that speed somewhere safe to land. The agent works on its own branch, you review its work as a pull request, continuous integration tests it automatically, and only then does it reach main. By the end of this course you will run that loop end to end, including two Claude Code sessions in parallel.

Each lesson gives you one concrete win: a simulator to drive, commands to recall from memory, or real steps in your own practice repository, penguins-lab.

Part 1: The branch workflow

  1. 01What is a branch?

    A branch is a movable pointer to a commit. Protect main in the simulator.

  2. 02Create, switch, compare

    Create penguins-lab, work on your first real branch, and see what changed with a three-dot diff.

  3. 03Merge and clean up

    Fast-forward versus merge commit, deleting branches safely, and resolving your first merge conflict.

  4. 04Push and pull requests

    Remotes, upstreams, and the GitHub flow: open, review, and squash-merge a pull request with gh.

  5. 05CI/CD and branches

    Run pytest on every pull request, read status checks, protect main, and deploy from it.

  6. 06Claude Code on a branch

    Brief Claude on an agent branch, review its diff, and know when to rewind, restore, or delete.

  7. 07Parallel sessions with worktrees

    Run two Claude Code sessions side by side with git worktree and claude -w.

  8. 08Notebooks and branches

    Why .ipynb files fight with branches, and how nbdime and Jupytext make peace.

  9. 09Capstone: the full loop

    Mixed retrieval practice, then issue → worktree → agent → PR → green CI → merge, all on your own.

Part 2: Judging the agent's work

Part 1 ends with the capstone and is a complete course on its own. Part 2 adds three lessons on a question Part 1 leaves open: when you compare an agent's branch with main, in code or in a score, what exactly are you comparing it with?

  1. 10Two diffs, two questions

    The merge base, and why a three-dot diff shows what a branch changed while a two-dot diff shows how two snapshots differ.

  2. 11When main moves

    Every merged pull request makes the other open branches stale. Spot it, update the branch, and check again.

  3. 12Fair baselines for evals

    Run a small eval on an agent's branch and compare it with the right baseline, so a gain isn't reported as a loss.

Reference

Before you start

Commands are written for Git Bash, macOS, or Linux terminals. Every claim links to official documentation (Pro Git, git-scm.com, GitHub Docs, Claude Code docs), retrieved October 2026. This site practises what it teaches: every change arrives on a branch, passes CI in a pull request, and deploys to GitHub Pages from main. See the repository.