Don't git reset --hard away three good commits to undo one bad one.
Single commit — git revert <sha> creates an inverse commit; history stays intact and shared-branch-safe.
One file from a commit — git checkout <good-sha> -- path/to/file.
Hunk-level — git checkout -p to revert specific changes, keep the rest.
A merge — git revert -m 1 <merge-sha> (pick the mainline parent).
On a shared branch, always revert (forward), never rewrite history. Reproduce the breakage first so you revert the RIGHT thing, then verify the revert actually fixes it.
1---2name: revert-surgical3description: Surgical Revert4---5# Surgical Revert6Don't `git reset --hard` away three good commits to undo one bad one.7- **Single commit** — `git revert <sha>` creates an inverse commit; history stays intact and shared-branch-safe.8- **One file from a commit** — `git checkout <good-sha> -- path/to/file`.9- **Hunk-level** — `git checkout -p` to revert specific changes, keep the rest.10- **A merge** — `git revert -m 1 <merge-sha>` (pick the mainline parent).11On a shared branch, always revert (forward), never rewrite history. Reproduce the breakage first so you revert the RIGHT thing, then verify the revert actually fixes it.
Run npx skillmds@latest add archive228/revert-surgical in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Surgical Revert It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
archive228 (@archive228) published this skill. Their other Agent Skills are listed on their SkillMD profile.