Skip to content

Recipes (Quick Cheat-Sheet References) ​

git-worktree: parallel branches ​

bash
# Open a hotfix branch next to your current work
git worktree add ../hotfix ./main -b hotfix/CVE-XXXX

# Open a reproducible customer-repro at exact SHA
git worktree add ../repro 9f3a1bc

# List and clean up
git worktree list
git worktree remove ../hotfix
git worktree prune

Quick reflog recovery (single branch, single commit) ​

bash
git reflog show --date=iso  # find the SHA before the bad push
git reset --hard <sha>
git reflog expire --expire-unreachable=now --expire=now --all

git-bisect: automated CI failure triage ​

bash
git bisect start; git bisect bad HEAD; git bisect good v2.3.0
git bisect run ./test-pass.sh
git bisect reset

Git Master — Git Reference for Every Skill Level