Roadmap › Git & GitHub — Version Control from Basics to Advanced › Module: Undo, Inspect and Advanced Git
Lessons in this course (10)
9. Cherry-pick, bisect, tags, blame and hooks
AdvancedMediumLesson 9 of 10
bash
git cherry-pick 4d5e6f # copy one commit onto the current branch (e.g. a hotfix into release)
git tag -a v2.3.0 -m "Release 2.3.0" && git push origin v2.3.0 # annotated tag for a release
git blame -L 40,60 OrderService.cs # who changed these lines and in which commit
git log -S "CalculateDiscount" --oneline # commits that added/removed this text
git bisect start; git bisect bad; git bisect good v2.2.0 # binary-search the commit that introduced a bug
git bisect run dotnet test # let tests decide good/bad automatically
git bisect resetHooks — scripts in .git/hooks (or managed by Husky / pre-commit): pre-commit (format, lint, block secrets), commit-msg (enforce message format), pre-push (run tests). Server-side checks belong in CI and branch policies, because local hooks can be skipped.
Big repos: Git LFS for large binaries, shallow clone (--depth 1) in CI, sparse-checkout for monorepos, git worktree to have two branches checked out at once.