git-stack-rewrite
Installation
SKILL.md
Git Stack Rewrite
Use this skill for history rewrites where staged changes or an existing source commit must be folded into an older target commit and branch stacks must be moved onto the rewritten replacement commit.
Supported prompt forms:
use git stack rewrite to squash commit [<source-commit>] into [<target-commit>]use git stack rewrite to fold the staged change into [<target-commit>]
Rules
- Treat this as destructive history rewriting even when it is local-only.
- Do not push unless the user explicitly asks.
- Never skip affected-branch discovery. Rewriting a base commit invalidates every branch on top of it, not only the branch currently checked out.
- In commit-to-target mode, the source commit must be reachable from the branch stack being rewritten, and normally must be a descendant of the target commit. Stop and explain if that ancestry is not true.
- Create backup refs before moving branch heads.
- Preserve user work. If the worktree has unrelated unstaged or untracked changes, report them and avoid touching them.