SuperAPI AI Directory

git-snapshot-rollback

Coding & development

View repository

Updated 10-15 17:31

About this skill

Git Snapshot & Rollback

This skill uses an automated script to ensure that when rolling back a Git commit, not only is the current attempt preserved (Snapshot), but also, through ARCHIVE.md , a traceable decision chain is constructed.

Core Workflow

1. Confirm the rollback target

  • Obtain the target Commit Hash that the user wants to roll back to.
  • Ask about or summarize the specific reason (Reason) for the rollback.

2. Execute the automated rollback script

  • Before execution, you must ask the user whether the archive branch needs to be pushed to the remote repository.
  • Use run_shell_command to call the skill's built-in script:
    • If the user agrees to push:python3 <path_to_skill>/scripts/rollback.py <Target_Commit> "<Reason>" --push
    • If the user does not agree to push (default):python3 <path_to_skill>/scripts/rollback.py <Target_Commit> "<Reason>"
  • The script will automatically complete:
    1. Commit all current uncommitted changes.
    2. Create the archive/{current_branch}/YYYY-MM-DD-HH-mm branch.
    3. Update the archive branch's ARCHIVE.md record.
    4. (Optional) Push the archive branch to the remote.
    5. Return to the original branch and execute git reset --hard。
    6. Update ARCHIVE.md on the original branch and commit the rollback record.
    7. List all branches currently ahead of the remote (unpushed).

3. Result verification

  • Check whether ARCHIVE.md has correctly recorded the bidirectional link for this rollback.
  • Confirm that the current branch is now at the target Commit state.

Recording conventions

  • Regarding ARCHIVE.md for the specific format, please refer to references/log-format.md。
  • The Commit Message of each rollback must include information about the source archive branch.

Usage prohibitions

  • It is strictly prohibited to directly execute git reset --hard to discard a large amount of work without using this skill.
  • Do not modify or delete ARCHIVE.md the historical records in.