/git-tools:squash-rebasefrom git-tools
Rebase the current branch onto main after its parent branch was squash-merged. Activates on "squash rebase", "rebase onto main", "parent branch was squash-merged", or when git rebase would re-apply already-merged commits.
Ships in git-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Rebase the current branch onto main, keeping only commits that are NOT already in main via a squash merge.
When a feature branch is started from another feature branch (e.g. feat/A), and feat/A later gets squash-merged into main, the current branch inherits all of feat/A's commits. Git cannot detect that those commits are already in main (the squash changed their SHA), so a plain git rebase main would conflict or re-apply duplicate work.
Verify we're on a branch (not detached HEAD) and that main exists.
Find the common ancestor:
git merge-base main HEAD
List all commits in the branch not in main:
git log --oneline main..HEAD
Show this to the user so they have full context.
Auto-detect the cut point using file overlap heuristic:
git log --format="%H" "<merge-base>..main" | tail -1git diff --name-only <squash>^ <squash>git diff --name-only <commit>^ <commit>Show the user:
Ask for confirmation. If the auto-detected cut point looks wrong, run git log --oneline <parent-branch> (if the parent branch still exists locally) to show the user the candidate commits, and ask them to pick the correct cut point.
Run:
git rebase --onto main <cut-point-hash>
If there are conflicts, explain them and help resolve. After resolution, run git rebase --continue.
Show the final git log --oneline -5 to confirm the clean result.
Remind the user they'll need git push --force-with-lease since history was rewritten.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub parmaster/claude-dlc --plugin git-tools