Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Advanced Git operations and workflows including interactive rebasing, conflict resolution, history manipulation, bisecting for bugs, cherry-picking, reflog recovery, and branch management strategies. Use for: (1) Interactive rebasing and commit cleanup, (2) Complex merge conflict resolution, (3) Git bisect for bug hunting, (4) History rewriting and cleanup, (5) Branch strategy implementation (Git Flow, trunk-based), (6) Recovering lost commits with reflog
.claude/skills/aiskillstore-git-advanced/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 315% | 0% |
| case-08 | ✓→✗ | ▼ Worse | 131% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 159% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 293% | 0% |
| case-13 | ✓→✓ | = Same ✓ | 118% | 0% |
Master advanced Git workflows for complex version control scenarios. This skill covers sophisticated operations beyond basic commits and merges, including interactive rebasing, advanced conflict resolution, history manipulation, and strategic branch management.
Use this skill when you need to:
bash# Rebase last 5 commits interactively git rebase -i HEAD~5 # Rebase onto main branch git rebase -i main # Continue after resolving conflicts git rebase --continue # Abort and return to original state git rebase --abort
bash# Accept ours (current branch) git checkout --ours <file> # Accept theirs (incoming branch) git checkout --theirs <file> # List conflicted files git diff --name-only --diff-filter=U # Mark as resolved git add <file>
bash# Start bisect session git bisect start git bisect bad git bisect good <commit-hash> # Automate with test script git bisect run ./test-script.sh # End bisect session git bisect reset
bash# Apply specific commit git cherry-pick <commit-hash> # Cherry-pick without committing git cherry-pick -n <commit-hash> # Cherry-pick range of commits git cherry-pick A^..B
bash# View reflog history git reflog # Recover lost commit git checkout -b recovery <commit-hash> # Reset to previous state git reset --hard HEAD@{2}
When to Use:
Steps:
bash# 1. Start interactive rebase for last N commits git rebase -i HEAD~5 # Interactive editor opens with commit list # Modify commands to reorganize history
Rebase Commands:
pick (p): Keep commit as-isreword (r): Keep commit, edit messageedit (e): Keep commit, stop to amendsquash (s): Combine with previous commit, keep messagefixup (f): Combine with previous commit, discard messagedrop (d): Remove commit entirelyExample:
bash# Before pick abc1234 Add feature X pick def5678 Fix typo pick ghi9012 WIP commit pick jkl3456 Update documentation # After cleanup pick abc1234 Add feature X fixup def5678 Fix typo drop ghi9012 WIP commit reword jkl3456 Update documentation
Safety Tips:
git branch backupgit reflog if something goes wronggit push --force-with-leaseFor detailed examples and advanced techniques, see examples/interactive_rebase.md.
Understanding Conflict Markers:
<<<<<<< HEAD (Current Change)
Your code from current branch
=======
Their code from merging branch
>>>>>>> branch-name (Incoming Change)Resolution Process:
bash# 1. Identify conflicts git status # 2. Choose resolution strategy: # Strategy A: Manual resolution vim <file> # Edit between markers git add <file> # Strategy B: Accept one side git checkout --ours <file> # Keep yours git checkout --theirs <file> # Keep theirs git add <file> # Strategy C: Use merge tool git mergetool # 3. Continue operation git merge --continue # or git rebase --continue
Three-Way Diff:
bash# Show what YOU changed git diff --ours <file> # Show what THEY changed git diff --theirs <file> # Show common ancestor git diff --base <file>
For common conflict patterns and solutions, see examples/conflict_resolution.md.
Scenario: Bug exists in current version, find which commit introduced it.
Manual Bisect:
bash# 1. Start bisect git bisect start # 2. Mark current state as bad git bisect bad # 3. Mark known good commit git bisect good v1.0.0 # 4. Test the code (Git checks out middle commit) # Run app, check if bug exists # 5. Mark result git bisect bad # If bug exists git bisect good # If bug doesn't exist # Repeat until Git finds first bad commit # 6. End bisect git bisect reset
Automated Bisect:
bash# Create test script (test.sh) #!/bin/bash npm test exit $? # Run automated bisect git bisect start git bisect bad git bisect good v1.0.0 git bisect run ./test.sh # Git automatically finds bad commit git bisect reset
Quick Cleanup:
bash# Use helper script bash scripts/git_helper.sh cleanup-branches # Or manual cleanup git branch --merged main | grep -v "\*\|main\|develop" | xargs git branch -d git fetch --prune
Stale Branch Detection:
bash# Show branches with last commit date for branch in $(git branch -r | grep -v HEAD); do echo -e "$(git show --format="%ci %cr" $branch | head -n 1)\t$branch" done | sort -r
For detailed branch management strategies, see references/branch-management.md.
Recover Deleted Branch:
bash# View reflog git reflog # Find commit where branch was deleted # Restore branch git checkout -b feature-x <commit-hash>
Undo Bad Reset:
bash# Accidentally ran: git reset --hard HEAD~5 # View reflog git reflog # Restore previous state git reset --hard HEAD@{1}
Recover Lost Commits:
bash# Find dangling commits git fsck --lost-found # Cherry-pick recovered commit git cherry-pick <lost-commit-hash>
For comprehensive recovery techniques, see references/reflog-recovery.md.
This skill supports implementing various branching strategies. Choose based on your team's needs:
Best for: Projects with scheduled releases, multiple production versions
Branch Types:
main: Production-ready codedevelop: Integration branchfeature/*: New featuresrelease/*: Release preparationhotfix/*: Production fixesQuick Start:
bash# Feature development git checkout develop git checkout -b feature/user-auth # Work on feature git checkout develop git merge --no-ff feature/user-auth
Best for: Continuous deployment, fast-moving teams
Principles:
Quick Start:
bash# Create short-lived branch git checkout main git checkout -b feature/quick-fix # Work and merge same day git checkout main git merge feature/quick-fix
For complete branch strategy workflows, see examples/branch_strategies.md.
git branch backupgit statusgit log --onelinefeature/user-loginFor comprehensive best practices, see references/best-practices.md.
bash# If conflicts are too complex git rebase --abort # Start over with different approach git merge --no-ff <branch>
bash# Always check reflog first git reflog # Find and recover git checkout -b recovery <commit-hash>
bash# Create branch from detached HEAD git checkout -b new-branch-name # Or go back to branch git checkout main
bash# Only if you're certain and branch is not shared git push --force-with-lease # Safer: Create new branch git checkout -b feature-v2 git push origin feature-v2
For detailed troubleshooting, see references/troubleshooting.md.
examples/interactive_rebase.md: Step-by-step rebase examples with scenariosexamples/conflict_resolution.md: Common conflict patterns and solutionsexamples/branch_strategies.md: Complete Git Flow and trunk-based workflowsreferences/branch-management.md: Branch cleanup automation and strategiesreferences/reflog-recovery.md: Recovery techniques and history rewritingreferences/best-practices.md: Comprehensive best practices and quality standardsreferences/troubleshooting.md: Common issues and emergency recoveryscripts/git_helper.sh: Branch cleanup and conflict resolution utilitiesbash# Interactive rebase git rebase -i HEAD~N # Abort operations git rebase --abort git merge --abort git cherry-pick --abort # View history git log --oneline --graph --all git reflog # Conflict resolution git checkout --ours <file> git checkout --theirs <file> # Recovery git fsck --lost-found git reflog # Cleanup git branch --merged | xargs git branch -d git fetch --prune
git branch backup--force-with-leaseMaster these advanced Git operations to maintain clean history, resolve conflicts efficiently, and manage complex development workflows with confidence.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 18,331 | 12,803 | -30% | 1 | 1 | 0% | 1,046 | 4,345 | +315% | 0 | 0 | — |
case-02 | fail→fail | 21,481 | 15,940 | -26% | 1 | 1 | 0% | 2,790 | 5,586 | +100% | 0 | 0 | — |
case-03 | pass→pass | 14,208 | 10,039 | -29% | 1 | 1 | 0% | 1,739 | 4,496 | +159% | 0 | 0 | — |
case-04 | pass→pass | 5,120 | 8,915 | +74% | 1 | 1 | 0% | 880 | 3,460 | +293% | 0 | 0 | — |
case-13 | pass→pass | 18,191 | 16,921 | -7% | 1 | 1 | 0% | 2,147 | 4,670 | +118% | 0 | 0 | — |
case-05 | pass→pass | 9,943 | 15,343 | +54% | 1 | 1 | 0% | 1,684 | 4,578 | +172% | 0 | 0 | — |
case-06 | pass→pass | 14,387 | 13,924 | -3% | 1 | 1 | 0% | 1,588 | 4,286 | +170% | 0 | 0 | — |
case-07 | pass→pass | 12,617 | 12,135 | -4% | 1 | 1 | 0% | 1,340 | 4,038 | +201% | 0 | 0 | — |
case-08 | pass→fail | 14,220 | 12,928 | -9% | 1 | 1 | 0% | 1,862 | 4,310 | +131% | 0 | 0 | — |
case-09 | fail→fail | 15,643 | 10,252 | -34% | 1 | 1 | 0% | 1,798 | 4,731 | +163% | 0 | 0 | — |
case-10 | pass→pass | 11,440 | 5,275 | -54% | 1 | 1 | 0% | 1,073 | 3,650 | +240% | 0 | 0 | — |
case-11 | pass→pass | 7,518 | 7,420 | -1% | 1 | 1 | 0% | 458 | 3,239 | +607% | 0 | 0 | — |
case-12 | pass→pass | 10,507 | 8,138 | -23% | 1 | 1 | 0% | 1,688 | 4,082 | +142% | 0 | 0 | — |
case-14 | pass→pass | 12,172 | 15,494 | +27% | 1 | 1 | 0% | 1,297 | 4,491 | +246% | 0 | 0 | — |
case-15 | pass→pass | 11,617 | 9,505 | -18% | 1 | 1 | 0% | 1,110 | 3,530 | +218% | 0 | 0 | — |
case-16 | pass→pass | 13,485 | 13,307 | -1% | 1 | 1 | 0% | 1,419 | 4,141 | +192% | 0 | 0 | — |
case-17 | pass→pass | 8,803 | 12,508 | +42% | 1 | 1 | 0% | 1,538 | 4,100 | +167% | 0 | 0 | — |
case-18 | pass→pass | 8,210 | 13,022 | +59% | 1 | 1 | 0% | 1,429 | 4,225 | +196% | 0 | 0 | — |
case-19 | pass→pass | 3,167 | 3,240 | +2% | 1 | 1 | 0% | 649 | 3,363 | +418% | 0 | 0 | — |
case-20 | pass→pass | 8,180 | 7,393 | -10% | 1 | 1 | 0% | 1,497 | 4,098 | +174% | 0 | 0 | — |
case-21 | pass→pass | 14,275 | 13,574 | -5% | 1 | 1 | 0% | 1,653 | 4,281 | +159% | 0 | 0 | — |
case-22 | pass→pass | 15,017 | 16,100 | +7% | 1 | 1 | 0% | 1,835 | 4,694 | +156% | 0 | 0 | — |
case-23 | pass→pass | 15,694 | 14,052 | -10% | 1 | 1 | 0% | 1,932 | 4,474 | +132% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 22 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of -100 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Other measured skills in the registry, with their headline benchmark lift.