git-history-surgery

Installation
SKILL.md

Git History Surgery

When to invoke

Trigger on any of:

  • "split this commit into smaller ones" (after a push)
  • "rebase this into atomic commits"
  • User points out a bulk commit and asks to fix history
  • You bulked a multi-concern change into one commit and caught it before/after pushing

Why a throwaway worktree

Doing git reset --soft HEAD~1 in an existing worktree is risky:

  • Another session might be on the same repo in a different worktree/branch. Your reset doesn't affect them, but switching branches there will.
  • If the worktree you're in isn't on the branch you think (e.g. ops/main worktree was on fix/usage-async-load in a past session), a reset rewrites the wrong branch.
  • Existing worktrees may carry uncommitted state you'd lose.

The safe pattern: fresh detached worktree at origin/, do surgery, push, discard.

Related skills
Installs
1
GitHub Stars
9
First Seen
9 days ago