undo-commit

undo-commit is a command for Claude Code from damusix/atomic-claude. It costs 31 tokens per session (846 once invoked), scanned A, original, MIT.

A command that reverses the latest local Git commit while keeping its changes staged for editing or recommitting. Git is the version-control system used to track code changes.

In plain words
What is it for?
Use it to reopen the last local, non-merge commit for changes; it does not undo the initial commit or a commit already published to a tracked remote.
Why use it?
It lets you undo a recent commit without discarding the work, while refusing cases where rewriting history could be unsafe.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it to reopen the last local, non-merge commit for changes; it does not undo the initial commit or a commit already published to a tracked remote.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/damusix/atomic-claude/undo-commit
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/damusix/atomic-claude

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for undo-commit

README.md
[![agentmods](https://agentmods.dev/badge/commands/damusix/atomic-claude/undo-commit/github.svg)](https://agentmods.dev/commands/damusix/atomic-claude/undo-commit)
Your own site
<a href="https://agentmods.dev/commands/damusix/atomic-claude/undo-commit"><img src="https://agentmods.dev/badge/commands/damusix/atomic-claude/undo-commit/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for undo-commit

Your own site · 80×15
<a href="https://agentmods.dev/commands/damusix/atomic-claude/undo-commit"><img src="https://agentmods.dev/badge/commands/damusix/atomic-claude/undo-commit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 846 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.00846
Opus 5.5 $0.00012 $0.00338
Sonnet 5.5 $0.00006 $0.00169
Haiku 4.5 $0.00003 $0.00085

Measured 12d ago against content hash c5f21d685134, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

undo-commit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

context/commands/undo-commit.md · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Reverses one commit without losing the work. Equivalent to git reset --soft HEAD~1 with safety guards.

Flow

Only a local, non-merge commit with a parent is undone, and only after the user confirms it.

flowchart TD
    G{"Inside a git repo?"} -->|no| X["Stop with<br/>that message"]
    G -->|yes| P{"HEAD has a parent?"}
    P -->|no| X
    P -->|yes| M{"HEAD is a merge?"}
    M -->|yes| X
    M -->|no| U{"HEAD already pushed?"}
    U -->|yes| X
    U -->|no| C{"User confirms?"}
    C -->|no| K["Print kept."]
    C -->|yes| R["Soft reset, report"]
  • Inside a git repo?: git rev-parse --is-inside-work-tree. No: not a git repo. /undo-commit requires a git repository.

  • HEAD has a parent?: git rev-parse HEAD^ 2>/dev/null succeeds. No: refused: HEAD is the initial commit. nothing to undo.

  • HEAD is a merge?: git rev-list --parents -n 1 HEAD | awk '{print NF-1}' prints 2 or more. Undoing a merge is destructive in a non-obvious way, so it goes back to the user. Yes: refused: HEAD is a merge commit. use git reset --hard ORIG_HEAD manually if you understand the consequences.

  • HEAD already pushed?: a soft undo of a published commit would rewrite public history. git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null finds the tracking branch; with none, HEAD is not pushed. With one, git merge-base --is-ancestor HEAD @{u} exiting 0 means pushed. Yes: refused: HEAD is already pushed to <upstream>. /undo-commit only undoes local commits. use git revert <sha> for a published commit.

  • User confirms?: show what is about to be undone with git log -n 1 --format=' %h %s%n %an, %ar%n%n Files:%n' HEAD and git diff --stat HEAD^..HEAD, then ask the user:

    Undo this commit? Changes will be moved back to the staging area.
    - Yes, undo
    - No, keep it
    
  • Print kept.: print kept. and take no action.

  • Soft reset, report: git reset --soft HEAD~1, then print:

    undone. HEAD now at <new-sha-short>.
    prior commit's changes are staged. inspect with: git status, git diff --cached
    to re-commit: /commit
    to discard: git restore --staged <paths> then git restore <paths>
    

Read the full file on GitHub · 68 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago Changed · -63 lines c5f21d685134
  2. 3mo ago First seen · 131 lines · 31 tokens per session scan A 1fc57693e90c

Subscribe to this mod's changes

undo-commit is a command published in the GitHub repository damusix/atomic-claude (117 stars, last pushed yesterday), licensed MIT. It adds 31 tokens to every session and 846 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

undo-commit compared with commands from other repositories

undo-commit next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
undo-commitdamusix/atomic-claudeCommand117yesterdayMITA31Claude Code
simplify-transformaxiomantic/spellbookCommand136d agoMITA14Claude Code
fix-tests-executeaxiomantic/spellbookCommand136d agoMITA23Claude Code
commitfuxicodex/FuxiCommand3.2k6d agononeA4Claude Code
verifyaxiomantic/spellbookCommand136d agoMITA31Claude Code
aligndsswift/ionCommand52d agoMITA51Claude Code
squashdsswift/ionCommand52d agoMITA25Claude Code