From 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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/git-hex:git-hex-branch-cleanupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill when the user wants to reshape a feature branch's commit history
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.38+ — 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.npx claudepluginhub yaniv-golan/git-hex --plugin git-hexCreates, edits, and verifies skills using a test-driven development approach with pressure scenarios and subagents.