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:
- initialize a repository
- create one file and commit it
- change the file and commit again
- 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:
- inspect with
statusanddiff - stage only one logical edit
- commit it
- 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:
- create a feature branch
- make two commits
- add one commit on
main - rebase the feature branch onto
main - 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:
- create divergent edits
- merge branches
- resolve the conflict manually
- 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:
- create uncommitted work and stash it
- move HEAD with a reset
- inspect reflog
- recover the earlier state
- 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, andlogwill 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:
- create a bare remote and two clones
- push a branch from clone A
- fetch from clone B without checking out the branch
- write what
origin/<branch>points to - 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:
- make four local commits: feature, typo, feature, debug
- use interactive rebase to squash typo commits and drop the debug commit
- run the test command for the repository, even if it is only a placeholder
- 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.