Git Advanced Workflows
Unverified●26/40Claude Code◐PartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
Cursor·UnknownWe have not crawled the repo tree, so we will not guess
Codex·UnknownWe have not crawled the repo tree, so we will not guess
Gemini CLI·UnknownThe spec defines no detection rule for Gemini
Copilot·UnknownWe have not crawled the repo tree, so we will not guess
npx agentalley add git-advanced-workflowsWho is stuck, and on what
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.
The whole source
Frontmatter — 2 properties
| name | git-advanced-workflows |
|---|---|
| description | 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. |
| 1 | --- |
| 2 | name: git-advanced-workflows |
| 3 | description: 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. |
| 4 | ---A5 — No allowed-tools declared — no way to tell what this skill may touch |
| 5 | |
| 6 | # Git Advanced Workflows |
| 7 | |
| 8 | Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence. |
| 9 | |
| 10 | ## When to Use This Skill |
| 11 | |
| 12 | - Cleaning up commit history before merging |
| 13 | - Applying specific commits across branches |
| 14 | - Finding commits that introduced bugs |
| 15 | - Working on multiple features simultaneously |
| 16 | - Recovering from Git mistakes or lost commits |
| 17 | - Managing complex branch workflows |
| 18 | - Preparing clean PRs for review |
| 19 | - Synchronizing diverged branches |
| 20 | |
| 21 | ## Core Concepts |
| 22 | |
| 23 | ### 1. Interactive Rebase |
| 24 | |
| 25 | Interactive rebase is the Swiss Army knife of Git history editing. |
| 26 | |
| 27 | **Common Operations:** |
| 28 | |
| 29 | - `pick`: Keep commit as-is |
| 30 | - `reword`: Change commit message |
| 31 | - `edit`: Amend commit content |
| 32 | - `squash`: Combine with previous commit |
| 33 | - `fixup`: Like squash but discard message |
| 34 | - `drop`: Remove commit entirely |
| 35 | |
| 36 | **Basic Usage:** |
| 37 | |
| 38 | ```bash |
| 39 | # Rebase last 5 commits |
| 40 | git rebase -i HEAD~5 |
| 41 | |
| 42 | # Rebase all commits on current branch |
| 43 | git rebase -i $(git merge-base HEAD main) |
| 44 | |
| 45 | # Rebase onto specific commit |
| 46 | git rebase -i abc123 |
| 47 | ``` |
| 48 | |
| 49 | ### 2. Cherry-Picking |
| 50 | |
| 51 | Apply specific commits from one branch to another without merging entire branches. |
| 52 | |
| 53 | ```bash |
| 54 | # Cherry-pick single commit |
| 55 | git cherry-pick abc123 |
| 56 | |
| 57 | # Cherry-pick range of commits (exclusive start) |
| 58 | git cherry-pick abc123..def456 |
| 59 | |
| 60 | # Cherry-pick without committing (stage changes only) |
| 61 | git cherry-pick -n abc123 |
| 62 | |
| 63 | # Cherry-pick and edit commit message |
| 64 | git cherry-pick -e abc123 |
| 65 | ``` |
| 66 | |
| 67 | ### 3. Git Bisect |
| 68 | |
| 69 | Binary search through commit history to find the commit that introduced a bug. |
| 70 | |
| 71 | ```bash |
| 72 | # Start bisect |
| 73 | git bisect start |
| 74 | |
| 75 | # Mark current commit as bad |
| 76 | git bisect bad |
| 77 | |
| 78 | # Mark known good commit |
| 79 | git bisect good v1.0.0 |
| 80 | |
| 81 | # Git will checkout middle commit - test it |
| 82 | # Then mark as good or bad |
| 83 | git bisect good # or: git bisect bad |
| 84 | |
| 85 | # Continue until bug found |
| 86 | # When done |
| 87 | git bisect reset |
| 88 | ``` |
| 89 | |
| 90 | **Automated Bisect:** |
| 91 | |
| 92 | ```bash |
| 93 | # Use script to test automatically |
| 94 | git bisect start HEAD v1.0.0 |
| 95 | git bisect run ./test.sh |
| 96 | |
| 97 | # test.sh should exit 0 for good, 1-127 (except 125) for bad |
| 98 | ``` |
| 99 | |
| 100 | ### 4. Worktrees |
| 101 | |
| 102 | Work on multiple branches simultaneously without stashing or switching. |
| 103 | |
| 104 | ```bash |
| 105 | # List existing worktrees |
| 106 | git worktree list |
| 107 | |
| 108 | # Add new worktree for feature branch |
| 109 | git worktree add ../project-feature feature/new-feature |
| 110 | |
| 111 | # Add worktree and create new branch |
| 112 | git worktree add -b bugfix/urgent ../project-hotfix main |
| 113 | |
| 114 | # Remove worktree |
| 115 | git worktree remove ../project-feature |
| 116 | |
| 117 | # Prune stale worktrees |
| 118 | git worktree prune |
| 119 | ``` |
| 120 | |
| 121 | ### 5. Reflog |
| 122 | |
| 123 | Your safety net - tracks all ref movements, even deleted commits. |
| 124 | |
| 125 | ```bash |
| 126 | # View reflog |
| 127 | git reflog |
| 128 | |
| 129 | # View reflog for specific branch |
| 130 | git reflog show feature/branch |
| 131 | |
| 132 | # Restore deleted commit |
| 133 | git reflog |
| 134 | # Find commit hash |
| 135 | git checkout abc123 |
| 136 | git branch recovered-branch |
| 137 | |
| 138 | # Restore deleted branch |
| 139 | git reflog |
| 140 | git branch deleted-branch abc123 |
| 141 | ``` |
| 142 | |
| 143 | ## Detailed patterns and worked examples |
| 144 | |
| 145 | Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient. |
| 146 | |
| 147 | ## Best Practices |
| 148 | |
| 149 | 1. **Always Use --force-with-lease**: Safer than --force, prevents overwriting others' work |
| 150 | 2. **Rebase Only Local Commits**: Don't rebase commits that have been pushed and shared |
| 151 | 3. **Descriptive Commit Messages**: Future you will thank present you |
| 152 | 4. **Atomic Commits**: Each commit should be a single logical change |
| 153 | 5. **Test Before Force Push**: Ensure history rewrite didn't break anything |
| 154 | 6. **Keep Reflog Aware**: Remember reflog is your safety net for 90 days |
| 155 | 7. **Branch Before Risky Operations**: Create backup branch before complex rebases |
| 156 | |
| 157 | ```bash |
| 158 | # Safe force push |
| 159 | git push --force-with-lease origin feature/branch |
| 160 | |
| 161 | # Create backup before risky operation |
| 162 | git branch backup-branch |
| 163 | git rebase -i main |
| 164 | # If something goes wrong |
| 165 | git reset --hard backup-branchA1 — Throws away uncommitted changes |
| 166 | ``` |
| 167 | |
| 168 | ## Common Pitfalls |
| 169 | |
| 170 | - **Rebasing Public Branches**: Causes history conflicts for collaborators |
| 171 | - **Force Pushing Without Lease**: Can overwrite teammate's work |
| 172 | - **Losing Work in Rebase**: Resolve conflicts carefully, test after rebase |
| 173 | - **Forgetting Worktree Cleanup**: Orphaned worktrees consume disk space |
| 174 | - **Not Backing Up Before Experiment**: Always create safety branch |
| 175 | - **Bisect on Dirty Working Directory**: Commit or stash before bisecting |
| 176 | |
| 177 | ## Recovery Commands |
| 178 | |
| 179 | ```bash |
| 180 | # Abort operations in progress |
| 181 | git rebase --abort |
| 182 | git merge --abort |
| 183 | git cherry-pick --abort |
| 184 | git bisect reset |
| 185 | |
| 186 | # Restore file to version from specific commit |
| 187 | git restore --source=abc123 path/to/file |
| 188 | |
| 189 | # Undo last commit but keep changes |
| 190 | git reset --soft HEAD^ |
| 191 | |
| 192 | # Undo last commit and discard changes |
| 193 | git reset --hard HEAD^A1 — Throws away uncommitted changes |
| 194 | |
| 195 | # Recover deleted branch (within 90 days) |
| 196 | git reflog |
| 197 | git branch recovered-branch abc123 |
| 198 | ``` |
| 199 |
Reviews
Installed this one?Write the first review and take the Trailblazer badge.
Alternatives
Subagent Driven DevelopmentUse when executing implementation plans with independent tasks in the current session◐◐◐◐◐●36/40Python Code Style & DocumentationPython code style, linting, formatting, naming conventions, and documentation standards. Use when writing new code, reviewing style, configuring linters, writing docstrings, or establishing project standards.◐····●35/40Competitor Price Analysis 💲Competitor pricing strategy analysis and market positioning. Price mapping, pricing gaps identification, elasticity signals evaluation, and strategic pricing optimization. Use when the user asks about competitor pricing, price analysis, pricing strategy, or co◐····●34/40Competitor Price Tracker 📊Set up competitor price tracking and monitoring workflows. Track price changes, detect promotions, analyze pricing patterns, and get alerts for competitive price movements.◐····●34/40