Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install vivekkarmarkar-claude-code-os-skills-gitrevertgit clone https://github.com/VivekKarmarkar/claude-code-os.gitcp claude-code-os/SKILL.MD ~/.claude/skills/vivekkarmarkar-claude-code-os-skills-gitrevert/SKILL.md--- name: gitrevert description: Revert all working directory files back to the last commit. Discards all uncommitted changes — modified files, new files, everything. The nuclear undo button. triggers: - "revert" - "undo everything" - "go back to last commit" - "reset to last commit" - "discard all changes" - "/gitrevert" --- # Git Revert — Reset Working Directory to Last Commit Discard ALL uncommitted changes and restore the working directory to the last committed state. This is the "undo everything I just did" button. ## What it does 1. Reverts all modified tracked files to their last committed state 2. Removes all new untracked files that were created since the last commit 3. Does NOT touch git history — no commits are lost, no branches are deleted ## Workflow ### Step 1: Show what will be lost Before reverting, show the user exactly what will be discarded: ```bash git status git diff --stat ``` Present clearly: ``` Files that will be reverted to last commit: Modified: path/to/file1.py Modified: path/to/file2.tsx New files that will be deleted: New: path/to/new-file.tsx Last commit: <hash> <message> ``` ### Step 2: Confirm Ask: "This will discard ALL uncommitted changes. Proceed?" Wait for explicit confirmation. Do NOT proceed without it. ### Step 3: Revert ```bash # Restore all tracked files to last commit git checkout -- . # Remove all untracked files and directories git clean -fd # Verify clean state git status ``` ### Step 4: Report ``` Reverted to: <commit hash> "<commit message>" Working directory is clean. ``` ## Rules 1. **ALWAYS show what will be lost before reverting.** Never silently discard work. 2. **ALWAYS get explicit confirmation.** The user must say yes. 3. **Never touch git history.** No `git reset --hard`, no `git rebase`, no `git push --force`. This skill only affects the working directory. 4. **If on a feature branch**, mention it: "You're on branch `addon/blackboard`. Reverting will discard changes on this branch but the branch itself remains."