Skip to content
Agentmart
Submit a tool

git-snapshot-rollback

存档当前的失败尝试分支,并安全回退到特定历史提交

Skill by cafe3310

IndexedApache-2.0★ 256
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/cafe3310-git-snapshot-rollback

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

存档当前的失败尝试分支,并安全回退到特定历史提交

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/git-snapshot-rollback

What's inside

Skill name
git-snapshot-rollback
Description
存档当前的失败尝试分支,并安全回退到特定历史提交
License
Apache-2.0
Instructions
37 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (3)

  • SKILL.md
  • log-format.md · references/
  • rollback.py · scripts/

SKILL.md (first lines)

# Git Snapshot & Rollback

此技能通过自动化脚本确保在回退 Git 提交时,不仅保留了当前的尝试(Snapshot),还通过 `ARCHIVE.md` 构建了一个可追溯的决策链表。

## 核心工作流

### 1. 确认回退目标
- 获取用户想要回退到的目标 Commit Hash。
- 询问或总结回退的具体原因(Reason)。

### 2. 执行自动化回退脚本
- **在执行前,必须询问用户是否需要将存档分支推送到远端仓库。**
- 使用 `run_shell_command` 调用技能内置脚本:
  - 如果用户同意推送:`python3 <path_to_skill>/scripts/rollback.py <Target_Commit> "<Reason>" --push`
  - 如果用户不同意推送(默认):`python3 <path_to_skill>/scripts/rollback.py <Target_Commit> "<Reason>"`
- **脚本将自动完成**:
    1. Commit 当前所有未提交的变更。
    2. 创建 `archive/{current_branch}/YYYY-MM-DD-HH-mm` 分支。
    3. 更新存档分支的 `ARCHIVE.md` 记录。
    4. (可选) 将存档分支推送到远端。
    5. 回到原分支并执行 `git reset --hard`。
    6. 在原分支更新 `ARCHIVE.md` 并提交回退记录。
    7. 列出当前所有领先于远程(未推送)的分支。

### 3. 结果验证
- 检查 `ARCHIVE.md` 是否已正确记录了本次回退的双向链接。
- 确认当前分支已处于目标 Commit 状态。

## 记录规范
- 关于 `ARCHIVE.md` 的具体格式,请参考 [references/log-format.md](references/log-format.md)。
- 每次回退的 Commit Message 必须包含来源存档分支的信息。

## 使用禁令
- 严禁在没有使用此技能的情况下直接执行 `git reset --hard` 来放弃大量工作。
- 不得修改或删除 `ARCHIVE.md` 中的历史记录。

From cafe3310/public-agent-skills, Apache-2.0.

More from cafe3310/public-agent-skills

Signals

Stars
256
Forks
30
Open issues
0
Last commit (this folder)
Jun 26, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from cafe3310

Cite this page

git-snapshot-rollback skill. Agent Mart. https://agentmart.dev/skills/cafe3310-git-snapshot-rollback (last updated 2026-10-24)