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.
penguins-lab.Part 1: The branch workflow
- 01What is a branch?
A branch is a movable pointer to a commit. Protect
mainin the simulator. - 02Create, switch, compare
Create
penguins-lab, work on your first real branch, and see what changed with a three-dot diff. - 03Merge and clean up
Fast-forward versus merge commit, deleting branches safely, and resolving your first merge conflict.
- 04Push and pull requests
Remotes, upstreams, and the GitHub flow: open, review, and squash-merge a pull request with
gh. - 05CI/CD and branches
Run pytest on every pull request, read status checks, protect
main, and deploy from it. - 06Claude Code on a branch
Brief Claude on an agent branch, review its diff, and know when to rewind, restore, or delete.
- 07Parallel sessions with worktrees
Run two Claude Code sessions side by side with
git worktreeandclaude -w. - 08Notebooks and branches
Why
.ipynbfiles fight with branches, and how nbdime and Jupytext make peace. - 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?
- 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.
- 11When
mainmovesEvery merged pull request makes the other open branches stale. Spot it, update the branch, and check again.
- 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
- Glossary: one term per idea, used consistently across every lesson.
- Branch cheat sheet: every command in the course on two printable pages.
- Claude Code branch workflow: the loop, prompt templates, review checklist, and recovery table.
- Branch practice tutor: a prompt that turns Claude into a hands-on coach for Lessons 1–5. It sets tasks, you type the commands, and it checks your repository.
Before you start
- Git installed, and a GitHub account where you can
clone,commit, andpush. - The GitHub CLI (
gh), logged in withgh auth login. - Python with
pandasandpytest, plus Claude Code from lesson 6 onward.
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.