From git-workflow
Recover the branch to its state before a git operation using the reflog. Use when the user wants to undo or reverse a merge, rebase, reset, amend, squash, or "bad" history rewrite, says "get my commits back", "I messed up the rebase", "revert to before I ran X", or fears they lost commits. This recovers via reflog, distinct from git revert (which makes a new inverse commit).
How this skill is triggered — by the user, by Claude, or both
Slash command
/git-workflow:undo-opThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Almost every history-changing operation is reversible because git records where
Almost every history-changing operation is reversible because git records where each ref pointed before it moved, in the reflog. Undoing means finding the entry just before the operation and moving the branch back to it.
git reflog (or git reflog show [branch]). Each line
shows a HEAD@{N} position and the operation that produced it (rebase,
commit --amend, reset, merge, …).git log --oneline HEAD@{N} and/or git show HEAD@{N}.git reset --hard HEAD@{N} (run on the affected branch). The branch
now points where it did before the operation.git revertgit revert adds a new commit that inverts a change — appropriate for undoing a
published commit. Here the goal is to rewind local history as if the operation
never happened, which reset --hard to a reflog position does cleanly. Because
reflog entries persist for a while, even a "lost" commit after a bad rebase is
usually still recoverable this way.
Caution: reset --hard discards uncommitted changes. If there are any, stash
them first with git stash (-u to include untracked files), then
git stash pop after the reset.
npx claudepluginhub paulinevos/claude-stuff --plugin git-workflowUndoes git-branchless operations like rebases, merges, branch changes, and checkouts. Quick undo last action, interactive history browsing, hide/unhide commits.
Undoes a bad git commit, file, or hunk without destroying unrelated work, using revert, checkout, or interactive patch.