Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 237% | 0% |
| case-20 | ✓→✗ | ▼ Worse | 18% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 245% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 147% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 190% | 0% |
<!-- source: wshobson-git-advanced-workflows — https://raw.githubusercontent.com/wshobson/agents/main/plugins/developer-essentials/skills/git-advanced-workflows/SKILL.md -->
Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.
Interactive rebase is the Swiss Army knife of Git history editing.
Common Operations:
pick: Keep commit as-isreword: Change commit messageedit: Amend commit contentsquash: Combine with previous commitfixup: Like squash but discard messagedrop: Remove commit entirelyBasic Usage:
bash# Rebase last 5 commits git rebase -i HEAD~5 # Rebase all commits on current branch git rebase -i $(git merge-base HEAD main) # Rebase onto specific commit git rebase -i abc123
Apply specific commits from one branch to another without merging entire branches.
bash# Cherry-pick single commit git cherry-pick abc123 # Cherry-pick range of commits (exclusive start) git cherry-pick abc123..def456 # Cherry-pick without committing (stage changes only) git cherry-pick -n abc123 # Cherry-pick and edit commit message git cherry-pick -e abc123
Binary search through commit history to find the commit that introduced a bug.
bash# Start bisect git bisect start # Mark current commit as bad git bisect bad # Mark known good commit git bisect good v1.0.0 # Git will checkout middle commit - test it # Then mark as good or bad git bisect good # or: git bisect bad # Continue until bug found # When done git bisect reset
Automated Bisect:
bash# Use script to test automatically git bisect start HEAD v1.0.0 git bisect run ./test.sh # test.sh should exit 0 for good, 1-127 (except 125) for bad
Work on multiple branches simultaneously without stashing or switching.
bash# List existing worktrees git worktree list # Add new worktree for feature branch git worktree add ../project-feature feature/new-feature # Add worktree and create new branch git worktree add -b bugfix/urgent ../project-hotfix main # Remove worktree git worktree remove ../project-feature # Prune stale worktrees git worktree prune
Your safety net - tracks all ref movements, even deleted commits.
bash# View reflog git reflog # View reflog for specific branch git reflog show feature/branch # Restore deleted commit git reflog # Find commit hash git checkout abc123 git branch recovered-branch # Restore deleted branch git reflog git branch deleted-branch abc123
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
bash# Safe force push git push --force-with-lease origin feature/branch # Create backup before risky operation git branch backup-branch git rebase -i main # If something goes wrong git reset --hard backup-branch
bash# Abort operations in progress git rebase --abort git merge --abort git cherry-pick --abort git bisect reset # Restore file to version from specific commit git restore --source=abc123 path/to/file # Undo last commit but keep changes git reset --soft HEAD^ # Undo last commit and discard changes git reset --hard HEAD^ # Recover deleted branch (within 90 days) git reflog git branch recovered-branch abc123
Other measured skills in the registry, with their headline benchmark lift.