| name | git-advanced |
| description | Advanced Git operations including rebase, cherry-pick, bisect, reflog, and recovery. Use when user asks to "rebase branch", "cherry-pick commit", "find bug with bisect", "recover lost commit", "squash commits", "fix git history", "interactive rebase", or any advanced git tasks. |
Git Advanced
Advanced Git operations and recovery techniques.
Interactive Rebase
git rebase -i HEAD~5
git rebase -i main
git rebase -i HEAD~3
git rebase --abort
git rebase --continue
git rebase --skip
Cherry-Pick
git cherry-pick abc1234
git cherry-pick abc1234..def5678
git cherry-pick --no-commit abc1234
git cherry-pick feature-branch~3
git cherry-pick --continue
git cherry-pick --abort
Bisect
git bisect start
git bisect bad
git bisect good v1.0.0
git bisect good
git bisect bad
git bisect reset
git bisect start HEAD v1.0.0
git bisect run npm test
git bisect run ./test-script.sh
Stash
git stash
git stash push -m "work on feature X"
git stash push -m "partial" path/to/file.js
git stash -u
git stash --include-untracked
git stash list
git stash pop
git stash apply
git stash pop stash@{2}
git stash show -p stash@{0}
git stash branch new-branch stash@{0}
git stash drop stash@{0}
git stash clear
Reflog (Recovery)
git reflog
git reflog show HEAD
git reflog show main
git reflog
git reset --hard HEAD@{2}
git reflog
git checkout -b recovered-branch abc1234
git reflog
git reset --hard HEAD@{5}
Reset vs Revert
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
git revert abc1234
git revert HEAD~3..HEAD
git revert --no-commit abc1234
git revert -m 1 abc1234
Worktrees
git worktree add ../project-hotfix hotfix-branch
git worktree add ../project-review origin/feature-branch
git worktree list
git worktree remove ../project-hotfix
git worktree prune
Log & History
git log --oneline --graph --all
git log --grep="fix bug"
git log -S "functionName"
git log -G "pattern"
git log --follow -- path/to/file.js
git blame path/to/file.js
git blame -L 10,20 path/to/file.js
git diff main..feature
git diff main...feature
git diff --name-only HEAD~5 HEAD
Cleanup
git clean -n
git clean -f
git clean -fd
git clean -fx
git gc
git gc --aggressive
git reflog expire --expire=30.days --all
Common Workflows
git checkout main
git merge --squash feature-branch
git commit -m "Add feature X"
git checkout feature
git rebase main
git checkout main
git merge feature
git commit --fixup=abc1234
git rebase -i --autosquash main
Reference
For recovery techniques and reflog patterns: references/recovery.md