Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问clear审计异常

git-recoverygit 恢复

Agent Skill

git-recovery 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

218

周安装

9

GitHub Stars

160

下载量

71
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:git-recovery(git 恢复)
来源仓库:https://github.com/yonatangross/orchestkit
仓库路径:skills/git-recovery
安装命令:
npx skills add https://github.com/yonatangross/orchestkit --skill git-recovery
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/yonatangross/orchestkit --skill git-recovery

简介

用于查找、检索和筛选相关信息。

  • 适合根据关键词、任务场景或来源线索快速定位候选结果。
  • 可结合来源仓库和原始 README 核验具体用法和功能细节。
  • 安装通过 npx skills add 命令从指定 GitHub 仓库获取,适用于 Codex、Claude、Cursor、Gemini CLI。
  • 建议确认权限范围、维护状态及是否触发联网、命令执行或文件读写。

SKILL.md

Git Recovery

Interactive recovery from common git mistakes. Safe operations with verification steps.

Quick Start

/git-recovery

Recovery Scenarios

When invoked, present these options to the user:

Option 1: Undo Last Commit (Keep Changes)

Scenario: You committed but want to modify the changes before recommitting.

# Check current state first
git log --oneline -3
git status

# Undo commit, keep changes staged
git reset --soft HEAD~1

# Verify
git status  # Changes should be staged
git log --oneline -1  # Previous commit is now HEAD

Safety: Non-destructive. All changes remain staged.


Option 2: Undo Last Commit (Discard Changes)

Scenario: You committed something completely wrong and want to throw it away.

WARNING: DESTRUCTIVE - Changes will be lost!

# CRITICAL: First, save a backup reference
BACKUP_REF=$(git rev-parse HEAD)
echo "Backup ref: $BACKUP_REF (save this to recover if needed)"

# Show what will be lost
git show HEAD --stat

# Confirm with user before proceeding
# Then execute:
git reset --hard HEAD~1

# Verify
git log --oneline -3
git status  # Should be clean

Recovery: If you made a mistake, run git reset --hard $BACKUP_REF


Option 3: Recover Deleted Branch

Scenario: You deleted a branch and need it back.

# Find the branch's last commit in reflog
git reflog | grep -i "branch-name"
# Or search all recent activity:
git reflog --all | head -30

# Once you find the commit hash (e.g., abc1234):
git checkout -b recovered-branch abc1234

# Verify
git log --oneline -5
git branch -v | grep recovered

Note: Reflog keeps entries for ~90 days by default.


Option 4: Reset File to Last Commit

Scenario: You modified a file and want to discard local changes.

WARNING: DESTRUCTIVE - Uncommitted changes to file will be lost!

# Show current changes to file
git diff path/to/file

# Confirm with user before proceeding
# Then restore:
git checkout HEAD -- path/to/file

# Or using newer git restore (Git 2.23+):
git restore path/to/file

# Verify
git status path/to/file  # Should show no changes
git diff path/to/file    # Should be empty

Option 5: Undo a Rebase

Scenario: A rebase went wrong and you want to return to pre-rebase state.

# Find the pre-rebase state
git reflog | head -20
# Look for entry like: "rebase (start): checkout main"
# The entry BEFORE that is your pre-rebase state

# Alternative: ORIG_HEAD is set automatically before rebase
git log --oneline ORIG_HEAD -3

# Reset to pre-rebase state
git reset --hard ORIG_HEAD

# Verify
git log --oneline -5
git status

Safety: ORIG_HEAD is overwritten by other operations, use reflog if ORIG_HEAD is stale.


Option 6: Undo a Merge

Scenario: You merged a branch and want to undo it.

# If merge commit exists and NOT pushed:
git log --oneline -5  # Find the merge commit

# Reset to before merge
git reset --hard HEAD~1

# If you need to specify which parent:
git reset --hard ORIG_HEAD

# Verify
git log --oneline -5
git branch -v

WARNING: If already pushed, use git revert -m 1 <merge-commit> instead to create a new commit that undoes the merge.


Option 7: Find Lost Commits (Reflog Deep Dive)

Scenario: You lost commits and need to find them.

# View full reflog with dates
git reflog --date=relative

# Search for specific text in commit messages
git reflog | xargs -I {} git log -1 --format="%h %s" {} 2>/dev/null | grep "search-term"

# Show reflog for specific branch
git reflog show branch-name

# Once found (e.g., abc1234), examine it:
git show abc1234

# Recover by creating a branch or cherry-picking:
git branch recovered-work abc1234
# Or:
git cherry-pick abc1234

Option 8: Unstage Files (Keep Changes)

Scenario: You staged files you didn't mean to stage.

# Unstage specific file
git reset HEAD path/to/file

# Or using newer git restore (Git 2.23+):
git restore --staged path/to/file

# Unstage all files
git reset HEAD

# Verify
git status  # Files should be unstaged but modified

Safety: Non-destructive. Changes remain in working directory.


Interactive Workflow

When /git-recovery is invoked:

  1. Show current git state: git status git log --oneline -5
  2. Present recovery options: Git Recovery Options: 1. Undo last commit (keep changes staged) 2. Undo last commit (discard changes) [DESTRUCTIVE] 3. Recover deleted branch 4. Reset file to last commit [DESTRUCTIVE] 5. Undo a rebase 6. Undo a merge 7. Find lost commits (reflog search) 8. Unstage files Which scenario? (1-8):
  3. For destructive operations:

- Always show what will be lost - Provide backup command - Require explicit confirmation

  1. After recovery:

- Run verification commands - Show new state - Confirm success

Safety Rules

  1. NEVER use --force on shared branches without explicit user confirmation
  2. ALWAYS show backup reference before destructive operations
  3. ALWAYS verify after each recovery operation
  4. Check if changes are pushed before suggesting reset vs revert

Common Gotchas

ProblemWrong ApproachRight Approach
Undo pushed commitgit reset --hardgit revert <commit>
Recover deleted branchPanicgit reflog + checkout
Undo rebase on shared branchgit resetgit revert each commit
Lost commits after resetAssume lostgit reflog saves the day

Related Skills

  • commit: Create commits with validation
  • stacked-prs: Manage PR stacks safely
  • release-management: Handle release branch operations

References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

trae

27.55%
按下载量换算20

windsurf

22.56%
按下载量换算16

Cursor

19.53%
按下载量换算14

kiro-cli

11.44%
按下载量换算8

Claude Code

7.93%
按下载量换算6

Antigravity

3.29%
按下载量换算2

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills