Claude-skill-registry git-hex-branch-cleanup
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/git-hex-branch-cleanup" ~/.claude/skills/majiayu000-claude-skill-registry-git-hex-branch-cleanup && rm -rf "$T"
manifest:
skills/data/git-hex-branch-cleanup/SKILL.mdsource content
Git-hex Branch Cleanup
When to use this Skill
This skill should be used when:
- The user says they want to "clean up", "rewrite", "polish", or "squash" a git history or feature branch.
- The user wants to rebase a branch onto another branch (e.g.
) and present a clean, reviewable set of commits.main - The user wants to split, squash, or reword commits using git-hex tools instead of manual interactive rebase.
Trigger phrases include: "clean up my commits", "squash fixups", "polish history", "rewrite commits", "rebase onto main", "make this branch reviewable".
Workflow
-
Plan first
- Call
to inspect the commit range you would modify.git-hex-getRebasePlan - Optionally call
to estimate whether the rebase is likely to conflict.git-hex-checkRebaseConflicts
- Call
-
Prepare changes
- For small edits to the last commit, prefer
.git-hex-amendLastCommit - For fixes to older commits, guide the user to edit and stage changes, then
use
targeting the original commit.git-hex-createFixup - For large or mixed commits, consider
to separate files into focused commits.git-hex-splitCommit
- For small edits to the last commit, prefer
-
Apply the rewrite
- Use
to reorder, drop, squash, or reword commits.git-hex-rebaseWithPlan - Prefer
andautoStash: true
when the working tree is dirty, following git-hex documentation.autosquash: true - Never use git-hex on shared or protected branches; operate on feature branches the user controls.
- Use
-
Safety and recovery
- If the result is not what the user wanted, call
to restore the previous state using git-hex backup refs.git-hex-undoLast - If a rebase pauses with conflicts, hand off to the conflict resolution Skill.
- If the result is not what the user wanted, call
Tools to prefer
- Planning:
,git-hex-getRebasePlangit-hex-checkRebaseConflicts - History rewrite:
,git-hex-rebaseWithPlan
,git-hex-createFixup
,git-hex-amendLastCommit
,git-hex-splitCommitgit-hex-cherryPickSingle - Recovery:
git-hex-undoLast
Key constraints
action requiresreword
field (without it, git opens an editor → hang).message- Messages must be single-line (no TAB/newline characters).
- For reordering commits, set
in the plan.requireComplete: true - Prefer
overfixup
unless you need to combine commit messages.squash - Tools that perform their own auto-stash (
,amendLastCommit
,splitCommit
) exposecherryPickSingle
when stash pop failed;stashNotRestored
uses Git's nativerebaseWithPlan
and does not emit this flag.--autostash