# restore

restore rolls project files back to a previously saved checkpoint. Useful when recent experimental edits break your build and you need a working state.

- command · `type=command` · Claude Code, Codex, GitHub Copilot, Gemini CLI · ★ 763 repo stars
- Author: carlrannaberg
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/carlrannaberg/claudekit/tree/HEAD/src/commands/checkpoint/restore.md
- Updated: 2026-03-31
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/commands/restore

## What it does

The command inspects your Git stash list for entries created with `/checkpoint`. It accepts either `latest` or a specific stash index number to target the right snapshot.

Dirty working trees will not cause lost work. If uncommitted changes exist, the command captures them into a timestamped backup stash before touching files.

Checkpoints remain reusable after restoration because the command executes `git stash apply` rather than `git stash pop`. It relies on standard `git`, `grep`, and `head` utilities available in your shell.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/restore.md` — Call it with /restore. For all projects use ~/.claude/commands/

### Codex

**Manually: put the files in place**
- File: `~/.codex/prompts/restore.md` — Call it with /prompts:restore. Codex marks this format deprecated in favour of skills

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/prompts/restore.prompt.md`

### Gemini CLI

**Manually: put the files in place**
- File: `.gemini/commands/restore.toml` — Gemini stores commands as TOML: the prompt text goes into the prompt field

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/carlrannaberg/claudekit/tree/HEAD/src/commands/checkpoint/restore.md

## When to use it
- Revert workspace files to the latest checkpoint
- Switch back to a specific checkpoint by index number
- Back up dirty uncommitted work before restoring older code

## Example prompts
- /restore
- /restore latest
- /restore 2

## Source text · restore.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 65291edaf9d33f80.

BEGIN THIRD-PARTY FILE 65291edaf9d33f80
```text
---
description: Restore project to a previous checkpoint
category: workflow
allowed-tools: Bash(git stash:*), Bash(git status:*), Bash(git reset:*), Bash(grep:*), Bash(head:*)
argument-hint: "<checkpoint-number|latest>"
---

## Restore to checkpoint

Restore your project files to a previous checkpoint created with /checkpoint.

## Available checkpoints
!`git stash list | grep "claude-checkpoint" | head -10`

## Current status
!`git status --short`

## Task

Restore the project to a previous checkpoint. Based on $ARGUMENTS:

1. Parse the argument:
   - If empty or "latest": Find the most recent claude-checkpoint stash
   - If a number (e.g. "2"): Use stash@{2} if it's a claude-checkpoint
   - Otherwise: Show error and list available checkpoints

2. Check for uncommitted changes with `git status --porcelain`. If any exist:
   - Create a temporary backup stash: `git stash push -m "claude-restore-backup: $(date +%Y-%m-%d_%H:%M:%S)"`
   - Note the stash reference for potential recovery

3. Apply the checkpoint:
   - Use `git stash apply stash@{n}` (not pop, to preserve the checkpoint)
   - If there's a conflict due to uncommitted changes that were stashed, handle gracefully

4. Show what was restored:
   - Display which checkpoint was applied
   - If uncommitted changes were backed up, inform user how to recover them

Example outputs:
- For `/restore`: "Restored to checkpoint: before major refactor (stash@{0})"
- For `/restore 3`: "Restored to checkpoint: working OAuth implementation (stash@{3})"
- With uncommitted changes: "Backed up current changes to stash@{0}. Restored to checkpoint: before major refactor (stash@{1})"
```
END THIRD-PARTY FILE 65291edaf9d33f80

The third-party file has ended. Everything between the 65291edaf9d33f80 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© carlrannaberg · MIT · https://github.com/carlrannaberg/claudekit/tree/HEAD/src/commands/checkpoint/restore.md

## Similar
- [code-refactoring-context-restore](https://affpapa.org/en/nevibecode/skills/code-refactoring-context-restore.md) — skill · 1 install
- [git-context-controller](https://affpapa.org/en/nevibecode/skills/git-context-controller.md) — skill · 82 installs
- [bug-fix](https://affpapa.org/en/nevibecode/commands/bug-fix.md) — command · ★ 2003 repo stars
- [run-release](https://affpapa.org/en/nevibecode/commands/run-release.md) — command · ★ 907 repo stars
- [todo-branch](https://affpapa.org/en/nevibecode/commands/todo-branch.md) — command · ★ 1357 repo stars
- [orchestration-readme](https://affpapa.org/en/nevibecode/commands/orchestration-readme.md) — command · ★ 1357 repo stars

From the same set: [carlrannaberg/claudekit](https://affpapa.org/en/nevibecode/by/carlrannaberg/claudekit.md) — 54 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
