AgentSkillsCN

regenerate

运行 git 命令,快速丢弃所有待处理但尚未提交的更改。

SKILL.md
--- frontmatter
name: regenerate
description: Run git commands to discard any pending uncommitted changes
allowed-tools:
  - Bash(git status *)
  - Bash(git diff *)
  - Bash(git checkout *)
  - Bash(git restore *)
  - Bash(git clean *)
  - Bash(git reset *)
  - Bash(git stash *)

Regenerate Skill

Discard uncommitted git changes to restore a clean working state. Like an ancient technique that restores order, this skill resets your environment to its rightful form.

Warning

This skill performs destructive operations that cannot be undone. Always confirm with the user before executing commands that discard changes.

Capabilities

  • Check State: View current git status and pending changes to see where the balance is broken.
  • Discard Changes: Reset tracked files and remove untracked files to return to a clean state.
  • Stash Changes: A safe alternative to save progress before restoring the environment.

Usage Examples

Discard all uncommitted changes:

code
/regenerate

Preview changes (Dry run):

code
/regenerate --dry-run

Stash changes instead of discarding:

code
/regenerate --stash

Discard changes to a specific file:

code
/regenerate src/app.js

Workflow

  1. Show Status: Display git status and git diff --stat to show what will be affected.
  2. Confirm: Ask for confirmation before any destructive action.
  3. Execute: Run the appropriate git commands with focus.
  4. Verify: Show final git status to confirm the clean state.

Commands Reference

CommandPurpose
git statusShow working tree status
git diffShow unstaged changes
git diff --cachedShow staged changes
git restore <file>Discard changes in working directory
git restore --staged <file>Unstage changes
git checkout -- <file>Discard changes (legacy)
git clean -fdRemove untracked files and directories
git clean -fdnDry run - preview removal
git reset --hard HEADReset all tracked files to HEAD
git stashSave changes to stash
git stash popRestore stashed changes

Safety Notes

  • Always show status first before any destructive operation.
  • Always confirm with the user before running git clean -f, git reset --hard, or git checkout --.
  • Suggest stash as a safer alternative when appropriate.
  • Never force operations without explicit user consent.