Skip to content
Productivity
Skill

/git-snapshot-rollback

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

From plugin
public-agent-skills
25946 skills4 agents

Claude Code

$ npx -y skills add cafe3310/public-agent-skills --skill git-snapshot-rollback --agent claude-code

SKILL.md

git-snapshot-rollback.SKILL.md
name: git-snapshot-rollback
description: 存档当前的失败尝试分支,并安全回退到特定历史提交
license: Apache-2.0
author: github/cafe3310
depends_on_skill: []
depends_on_binary:
  - git
  - python3

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` 中的历史记录。
@cafe3310
Ships withpublic-agent-skills

个人常用的 Agent Skill(公开部分)。通过合适的上下文工程,可以将 Agent Skill 用在几乎任何地方。

25946 skills4 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
259
Star history of cafe3310/public-agent-skills on GitHub, a chart by star-history.com

Other skills on public-agent-skills.

agent-browser

agent-browser

为 Agent 设计的自动化浏览器 CLI 工具,也能操作 Electron 桌面应用。当需要与网站交互(包括页面导航)时使用

aop-product-planner

aop-product-planner

面向切面 (AOP) 的智能产品策划与需求拆解范式。用于从目标叙事、AOP 切面分层、乱序 Idea 收集、功能边界界定到需求依赖拓扑与优先级的全流程产品工程规划。

More skills from other plugins.

i-have-adhd

i-have-adhd

Shape output for a reader with ADHD: lead with the next action, number multi-step work, restate state across turns, suppress…

@ayghri@ayghriInstall Skill
ab-test-analysis

ab-test-analysis

Analyze A/B test results with statistical significance, sample size validation, confidence intervals, and ship/extend/stop…

pm-skills11d28k
@phuryn@phurynInstall Skill
distilly

distilly

Set up the owner profile so a personal agent knows who it works for (first-run setup, \"get to know me\"), or distill colleague,…

Questions about git-snapshot-rollback.

Which coding agents can use git-snapshot-rollback?
git-snapshot-rollback installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.