git-checkpoint

Creates git checkpoint commits before risky changes and rolls back failed edits.

5.4k|1.3k|Updated Sep 23, 2025
One-click install
npx skills add https://github.com/agentscope-ai/agentscope-java --skill git-checkpoint
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-checkpoint
Source: https://github.com/agentscope-ai/agentscope-java/tree/main/agentscope-examples/agents/agentscope-codingagent/src/main/resources/workspace-templates/skills/git-checkpoint
Command: npx skills add https://github.com/agentscope-ai/agentscope-java --skill git-checkpoint

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When an agent performs large refactors or uncertain multi-file edits, a single bad change can corrupt the working tree with no easy way back. This Skill turns git into an undo mechanism so risky work can be attempted boldly and reverted cleanly.

Core Features & Use Cases

  • Checkpoint Commits: Saves the current good state with git add -A && git commit before any risky or large-scale change, recording the commit hash for later return.
  • Rollback Strategies: Discards uncommitted changes per-file with git checkout -- <file>, resets everything with git reset --hard HEAD, or returns to a recorded checkpoint hash.
  • Clean History Rules: Forbids .bak backup files and requires squashing or resetting checkpoint commits before pushing the final PR branch.
  • Use Case: Before refactoring a module across ten files, create a checkpoint commit; if the refactor breaks the build and cannot be quickly fixed, run git reset --hard <checkpoint-hash> and try a different approach.

Quick Start

Ask the agent to create a git checkpoint before starting the refactor and roll back to it if the changes make things worse.

Frequently Asked Questions about git-checkpoint

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a git checkpoint before a large refactor?

Run `git add -A && git commit -m "checkpoint: before <description>" --no-verify` to save the current state, then record the hash with `git rev-parse HEAD` so you can return to it later.

How to roll back uncommitted changes in git?

Use `git checkout -- <file>` to discard changes to a single file, or `git reset --hard HEAD` to discard all uncommitted changes. To return to a saved checkpoint, run `git reset --hard <checkpoint-hash>`.

When should I use git reset --hard versus git checkout?

Use `git checkout -- <file>` when only specific files need reverting and other work should be kept. Use `git reset --hard` when the entire change set failed and you need to return to a known-good commit.

Should checkpoint commits be pushed to the remote branch?

No. Checkpoint commits are local scaffolding only. Squash or reset them before pushing the final PR branch so the published history stays clean and readable.

Why avoid .bak backup files when using git?

Git already tracks full history, making `.bak` files redundant clutter that pollutes the working tree. Checkpoints and commits provide the same safety with proper versioning and clean rollback.