/git-hex:git-hex-branch-cleanupfrom git-hex
Rewrite git branch history. Invoke for any commit manipulation: squash, reword, reorder, drop, split, fold fixups, amend, or rebase onto main. Handles "clean up my commits", "squash before PR", "fix commit message typo", "make branch reviewable", "fold in fixup commits", "drop a commit", "rebase my branch". Operates on existing commits using git-hex MCP tools — no interactive rebase needed. NOT for: merge conflicts, cherry-picks across branches, conflict checking, git concepts, or hooks setup.
Ships in git-hex. 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.
Use this skill when the user wants to reshape a feature branch's commit history using git-hex tools instead of manual interactive rebase.
git-hex-getRebasePlan to see the commit range.
count to control how far back (default 10, max 200).onto is omitted it defaults to @{upstream} or HEAD~count.git-hex-checkRebaseConflicts to predict conflicts before
starting. This requires git 2.40+ — if the user's git is older, skip it
and note the limitation.| Goal | Tool | Notes |
|---|---|---|
| Edit the last commit (message or content) | amendLastCommit | Use addAll: true to stage tracked changes automatically. Needs at least staged changes OR a new message. |
| Fix an older commit | createFixup → rebaseWithPlan | User must stage changes first. Then createFixup targets the commit; follow with rebaseWithPlan using autosquash: true to fold it in. |
| Reorder, drop, squash, or reword | rebaseWithPlan | Pass a plan array. For reordering, set requireComplete: true. |
| Break a commit into focused pieces | splitCommit | Requires splits array with ≥2 entries. Every file in the original commit must appear in exactly one split. |
| Cherry-pick a single commit | cherryPickSingle | Rejects merge commits. Use abortOnConflict: false to pause on conflicts instead of aborting. |
autoStash: true when the working tree is dirty.
rebaseWithPlan uses git's native --autostash.amendLastCommit uses --keep-index mode (preserves staged changes).splitCommit and cherryPickSingle use git-hex's own stash helper.Tools that manage their own stash (amendLastCommit, splitCommit,
cherryPickSingle) return stashNotRestored: true if the stash pop fails
after the operation succeeds. When you see this:
git stash list to find the stash entry, then
git stash pop manually to resolve any conflicts.rebaseWithPlan uses git's native --autostash and does not emit this flag —
git handles it internally.
git-hex-undoLast to restore the state before the last git-hex
operation.force: true only if commits were
added after the backup or untracked files would be overwritten.reword requires message — without it, git opens an editor and hangs.message
fields for reword, splitCommit, or createFixup.createFixup needs staged changes — it doesn't stage anything itself.
Remind the user to git add first.requireComplete: true — when reordering, every commit in the range must
appear in the plan. Without this, unmentioned commits default to pick.fixup over squash unless the user wants to combine commit
messages (squash opens an editor-like message merge; fixup silently discards).splitCommit rejects them.getRebasePlan and rebaseWithPlan warn about this in
their summary. Flag it to the user if unexpected.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub yaniv-golan/git-hex --plugin git-hex3 skills in this plugin
/git-hex-conflict-resolutionUse whenever a git operation is mid-flight and needs help finishing. Triggers: "continue the rebase", "abort the rebase", "conflicts in files", "rebase stopped/stuck/paused", "cherry-pick conflict", "revert has conflicts", "merge conflict", git status showing unmerged paths, or any git-hex tool returning paused/conflict/conflictingFiles status. Helps resolve conflicting files one by one, then continue or abort the operation. Applies to rebase, merge, cherry-pick, and revert — but only when already in progress. NOT for starting new rebases, creating PRs, squashing, fixup commits, undoing completed operations, or git-hex setup.
/git-hex-pr-workflowTrigger whenever the user's message contains "PR", "pull request", or "review feedback" — regardless of what else they ask for. This includes: "open a PR", "create a PR", "prepare for PR", "update my PR", "clean up and open a pull request", "address review comments", "reviewer wants", "PR #number". Even if the request also involves squashing, rebasing, or fixing commits, trigger this skill as long as a PR or review is part of the goal. Do NOT trigger for local-only git work (squash, amend, cherry-pick, rebase, conflict resolution) where no pull request or code review is mentioned. Do NOT trigger for branch protection rules or repo settings.