git-snapshot-rollback
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Snapshot & Rollback
Git Snapshot & Rollback
此技能通过自动化脚本确保在回退 Git 提交时,不仅保留了当前的尝试(Snapshot),还通过 构建了一个可追溯的决策链表。
ARCHIVE.mdThis skill ensures that when rolling back Git commits, not only are current attempts (Snapshot) retained, but also a traceable decision chain is built through via automated scripts.
ARCHIVE.md核心工作流
Core Workflow
1. 确认回退目标
1. Confirm Rollback Target
- 获取用户想要回退到的目标 Commit Hash。
- 询问或总结回退的具体原因(Reason)。
- Obtain the target Commit Hash that the user wants to roll back to.
- Ask or summarize the specific reason for the rollback.
2. 执行自动化回退脚本
2. Execute Automated Rollback Script
- 在执行前,必须询问用户是否需要将存档分支推送到远端仓库。
- 使用 调用技能内置脚本:
run_shell_command- 如果用户同意推送:
python3 <path_to_skill>/scripts/rollback.py <Target_Commit> "<Reason>" --push - 如果用户不同意推送(默认):
python3 <path_to_skill>/scripts/rollback.py <Target_Commit> "<Reason>"
- 如果用户同意推送:
- 脚本将自动完成:
- Commit 当前所有未提交的变更。
- 创建 分支。
archive/{current_branch}/YYYY-MM-DD-HH-mm - 更新存档分支的 记录。
ARCHIVE.md - (可选) 将存档分支推送到远端。
- 回到原分支并执行 。
git reset --hard - 在原分支更新 并提交回退记录。
ARCHIVE.md - 列出当前所有领先于远程(未推送)的分支。
- Before execution, you must ask the user whether to push the archive branch to the remote repository.
- Use to call the skill's built-in script:
run_shell_command- If the user agrees to push:
python3 <path_to_skill>/scripts/rollback.py <Target_Commit> "<Reason>" --push - If the user disagrees with pushing (default):
python3 <path_to_skill>/scripts/rollback.py <Target_Commit> "<Reason>"
- If the user agrees to push:
- The script will automatically complete the following:
- Commit all uncommitted changes.
- Create the branch.
archive/{current_branch}/YYYY-MM-DD-HH-mm - Update the record in the archive branch.
ARCHIVE.md - (Optional) Push the archive branch to the remote.
- Return to the original branch and execute .
git reset --hard - Update in the original branch and commit the rollback record.
ARCHIVE.md - List all branches that are currently ahead of the remote (unpushed).
3. 结果验证
3. Result Verification
- 检查 是否已正确记录了本次回退的双向链接。
ARCHIVE.md - 确认当前分支已处于目标 Commit 状态。
- Check whether has correctly recorded the bidirectional links for this rollback.
ARCHIVE.md - Confirm that the current branch is in the target Commit state.
记录规范
Recording Specifications
- 关于 的具体格式,请参考 references/log-format.md。
ARCHIVE.md - 每次回退的 Commit Message 必须包含来源存档分支的信息。
- For the specific format of , please refer to references/log-format.md.
ARCHIVE.md - The Commit Message for each rollback must include information about the source archive branch.
使用禁令
Usage Prohibitions
- 严禁在没有使用此技能的情况下直接执行 来放弃大量工作。
git reset --hard - 不得修改或删除 中的历史记录。
ARCHIVE.md
- It is strictly forbidden to directly execute to discard a large amount of work without using this skill.
git reset --hard - Do not modify or delete historical records in .
ARCHIVE.md