A companion repo for the article "The git Commands You Forgot Exist".
Reading about git bisect is one thing. Running it against a repo that actually has a baked-in bug is another.
This lab gives you a crafted git history — real commits, real branches, a real bug, a real moved-code refactor, a real hardcoded secret — so every exercise works against something genuine.
git clone https://github.com/copyleftdev/git-archaeology-lab
cd git-archaeology-lab
bash setup.sh
cd demo-reposetup.sh takes about 5 seconds. It creates demo-repo/ with a full git history ready for all 10 exercises.
Requirements: git ≥ 2.25, Python ≥ 3.8 (for the bisect exercise). Nothing else.
| # | Command | What you'll do |
|---|---|---|
| 01 | git worktree |
Run two branches side-by-side without switching |
| 02 | git bisect run |
Automated binary search to find a baked-in bug |
| 03 | git rerere |
Resolve a conflict once; watch git re-apply it |
| 04 | git log -S |
Find when a hardcoded secret was added and removed |
| 05 | git notes |
Attach deployment metadata without touching history |
| 06 | git range-diff |
Verify a rebase didn't silently alter any patches |
| 07 | git sparse-checkout |
Materialize only the packages you need |
| 08 | --fixup + --autosquash |
Fix any past commit without an awkward interactive rebase |
| 09 | git blame -C |
Follow authorship through a file-to-file refactor |
| 10 | git bundle |
Pack the entire repo into a portable file |
Each exercise is self-contained. Do them in order or jump to whichever command you want to try.
The setup.sh script builds this history from scratch every time — so you can always inspect it, blow it away, and regenerate cleanly.
v0.1.0 init: project skeleton
feat: add word_frequency
feat: add top_words
chore: add metrics token (temp) ← pickaxe target
fix: remove hardcoded token, use env var ← pickaxe target
feat: add sentence_count
feat: add strip_punctuation
v0.3.0 (last known-good tag before the bug)
refactor: extract frequency module ← blame -C target
perf: optimize split (THE BUG) ← bisect target
feat: add char_frequency
chore: register new api routes
HEAD
Branches:
feature/lowercase-count ← rerere conflict branch A
fix/split-whitespace ← rerere conflict branch B / worktree target
polish/v1 ← range-diff source
polish/v2 ← range-diff target
Tags: v0.1.0, v0.2.0, v0.3.0
cd ..
rm -rf demo-repo
bash setup.sh- Article: The git Commands You Forgot Exist
- Issues and PRs welcome — especially if you find a step that doesn't work on your platform.