Git Undo

VerifiedSafe

Unstages the last commit while preserving changes in the staging area. Useful for correcting commit messages or adding omitted files before recommitting.

Sby Skills Guide Bot
DevelopmentBeginner
1006/2/2026
Claude CodeCursorWindsurf
#git#undo#commit#reset#staging

Recommended for

Our review

Undoes the last commit while keeping changes in the staging area.

Strengths

  • Quickly fix the commit message
  • Retains already staged changes
  • Non-destructive and easily reversible

Limitations

  • Only works for the most recent commit
  • Does not alter the content of the previous commit (only message or missing files)
  • Requires basic git knowledge
When to use it

Use when you need to amend the commit message or add missing files that should have been included.

When not to use it

Avoid if the commit has already been pushed to a shared remote repository, as it rewrites history.

Security analysis

Safe
Quality score90/100

The skill only runs a local git command to undo the last commit while keeping changes staged. There is no network access, file deletion, secret exfiltration, or any destructive action. It does not disable safety features or execute arbitrary code. The allowed-tools restriction is appropriate.

No concerns found

Examples

Undo last commit while keeping staged changes
Undo my last commit but keep the changes staged so I can fix the commit message or add missing files.

name: git-undo description: Undo the last commit while keeping changes staged. Use when you need to fix a commit message or add missing files. disable-model-invocation: true allowed-tools: Bash(git:*)

Git Undo

Undo the last commit but keep changes staged.

  1. Undo the last commit but keep the file changes in the staging area.
    • Command: git reset --soft HEAD~1
    • This allows you to fix the commit message or add missing files before committing again.
Related skills