Skip to main content

Code Katas

Focused, repeatable Git exercises designed to build fluency. Do these in throwaway repositories until the inspection and command sequence feel automatic.

Kata 1: Build a Clean First History

Time limit: 15 minutes
Goal: Move from git init to a clean two-commit history
Setup: Empty folder

Tasks:

  1. initialize a repository
  2. create one file and commit it
  3. change the file and commit again
  4. show the history with git log --oneline --graph --decorate

Repeat until: You can do it without looking up the command order.

Kata 2: Split One Messy File into Two Commits

Time limit: 20 minutes
Goal: Use the index intentionally
Setup: One file with two unrelated edits

Tasks:

  1. inspect with status and diff
  2. stage only one logical edit
  3. commit it
  4. stage and commit the remaining edit

Repeat until: You can explain what is in the working tree and index at each step.

Kata 3: Branch, Rebase, and Read the Graph

Time limit: 20 minutes
Goal: Understand how local history changes under rebase
Setup: Repository with main

Tasks:

  1. create a feature branch
  2. make two commits
  3. add one commit on main
  4. rebase the feature branch onto main
  5. inspect the graph and explain what changed

Repeat until: You can say why the final content may match a merge but the history differs.

Kata 4: Trigger and Resolve a Conflict

Time limit: 20 minutes
Goal: Remove fear around conflict markers
Setup: Two branches editing the same lines

Tasks:

  1. create divergent edits
  2. merge branches
  3. resolve the conflict manually
  4. complete the merge and inspect the result

Repeat until: Conflict markers no longer feel surprising.

Kata 5: Recover with Stash and Reflog

Time limit: 20 minutes
Goal: Practice safe recovery moves
Setup: Throwaway repository with two commits

Tasks:

  1. create uncommitted work and stash it
  2. move HEAD with a reset
  3. inspect reflog
  4. recover the earlier state
  5. reapply the stash

Repeat until: You can explain which layer changed at each step.

Completion Standard

  • Can complete each kata inside the time limit
  • Can explain the state transitions, not just run the commands
  • No longer need to guess what status, diff, and log will show next

Additional Fluency Katas

Kata 6: Remote-Tracking Diagnosis

Time limit: 12 minutes
Goal: Predict remote and local branch state after fetch/push operations

Tasks:

  1. create a bare remote and two clones
  2. push a branch from clone A
  3. fetch from clone B without checking out the branch
  4. write what origin/<branch> points to
  5. push one new commit from clone A and explain why clone B is stale until it fetches

Kata 7: Reviewable Rebase

Time limit: 18 minutes
Goal: Clean a local branch without hiding risk

Tasks:

  1. make four local commits: feature, typo, feature, debug
  2. use interactive rebase to squash typo commits and drop the debug commit
  3. run the test command for the repository, even if it is only a placeholder
  4. write the final pull request description from the cleaned history

Repeat until: You can state the difference between cleaning private history and rewriting shared history without hesitation.