bl-undo

Undo git-branchless operations - recover from mistakes interactively

9 stars

Best use case

bl-undo is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Undo git-branchless operations - recover from mistakes interactively

Teams using bl-undo should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/bl-undo/SKILL.md --create-dirs "https://raw.githubusercontent.com/jpoutrin/product-forge/main/plugins/git-workflow/skills/bl-undo/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/bl-undo/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How bl-undo Compares

Feature / Agentbl-undoStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Undo git-branchless operations - recover from mistakes interactively

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# /bl-undo - Git-Branchless Undo & Recovery

**Category:** Git Workflow

Recover from mistakes using git-branchless's powerful undo system. Browse repository history and restore previous states.

## Usage

```
/bl-undo [options]
```

## Options

| Option | Description |
|--------|-------------|
| (none) | Quick undo of last operation |
| `-i` | Interactive mode - browse history |
| `--hide <hash>` | Hide a commit from smartlog |
| `--unhide <hash>` | Restore a hidden commit |

## Examples

```bash
# Undo the last operation
/bl-undo

# Interactive undo - browse and select state
/bl-undo -i

# Hide an experimental commit
/bl-undo --hide abc1234

# Restore a hidden commit
/bl-undo --unhide abc1234
```

## What Can Be Undone

- Commits and amended commits
- Rebases and merges
- Branch creations, moves, deletions
- Checkouts

## What Cannot Be Undone

- Uncommitted file changes
- Untracked file changes
- Pushed commits (remote changes)

## Execution

This command delegates to the `bl-undo-expert` agent:

```
Task(subagent_type="git-workflow:bl-undo-expert",
     prompt="Execute undo: <options>")
```

## Execution Instructions

1. **Assess Situation**
   - Show current state with `git sl`
   - Identify what might need undoing

2. **Execute Undo**
   - For quick: Run `git undo`, confirm
   - For interactive: Run `git undo -i`, guide navigation
   - For hide/unhide: Run respective command

3. **Verify Result**
   - Show final state with `git sl`
   - Confirm expected commits are present

## Interactive Flow

```
User: /bl-undo

Agent: Checking last operation...

Last operation: git rebase -i main
  - Dropped: "feat: add OAuth"
  - Reordered: 2 commits

This will restore:
◆ abc1234 (main) initial commit
┃
◯ def5678 feat: add auth base
┃
◯ ghi9012 feat: add OAuth       ← Will be restored
┃
◯ jkl3456 feat: add Google login
┃
● mno7890 feat: add GitHub login

Undo this operation? [y/n]:
```

```
User: /bl-undo -i

Agent: Opening interactive undo...

git undo -i

This opens a browser interface. Use:
  ← → arrow keys to navigate through time
  Each state shows the smartlog at that point
  Find the state BEFORE your mistake
  Press Enter to select, then y to confirm

[User navigates in terminal]

After user confirms...

◆ abc1234 (main) initial commit
┃
◯ def5678 feat: add User class
┃
◯ ghi9012 feat: add validation
┃
● jkl3456 feat: add repository

Restored to state before the bad rebase.
All 3 commits recovered.
```

```
User: /bl-undo --hide abc1234

Agent: Hiding commit abc1234...

Before:
◆ main initial commit
┃
◯ abc1234 feat: experimental  ← Will be hidden
┃
◯ def5678 feat: add User class
┃
● ghi9012 feat: add validation

git hide abc1234

After:
◆ main initial commit
┃
◯ def5678 feat: add User class
┃
● ghi9012 feat: add validation

Commit hidden from smartlog.

⚠️  Warning: Hidden commits may be garbage collected.
To restore later: /bl-undo --unhide abc1234
```

## Common Recovery Scenarios

### Bad Rebase Removed Commits
```
User: I accidentally dropped a commit during rebase!

Agent: Let's recover it with interactive undo...
/bl-undo -i
Navigate to state before the rebase, select, confirm.
```

### Wrong Commit Amended
```
User: I amended the wrong commit!

Agent: Quick undo will restore it...
/bl-undo
Confirm to restore pre-amend state.
```

### Stack Got Messed Up
```
User: My stack is completely messed up after multiple operations

Agent: Interactive undo can go back multiple operations...
/bl-undo -i
Navigate back to when the stack was correct.
May need to go back several states.
```

### Want to Hide Experimental Work
```
User: I have some experimental commits cluttering my smartlog

Agent: Hide them to clean up the view...
/bl-undo --hide <hash>
They won't show in git sl but can be restored.
```

## Error Handling

| Error | Resolution |
|-------|------------|
| "Nothing to undo" | No recent undoable operations |
| "Working directory dirty" | Stash or commit changes first |
| "Would cause conflicts" | Use `-i` to find different restore point |
| Lost uncommitted changes | Cannot recover - check editor undo |
| Pushed commits | Must revert on remote instead |

## Tips

1. **Commit before risky operations** - Makes undo possible
2. **Use `-i` for complex recovery** - Better visibility of history
3. **Hidden commits aren't permanent** - May be garbage collected
4. **Check result immediately** - Run `git sl` after undo

Related Skills

zod

9
from jpoutrin/product-forge

Zod schema validation patterns and type inference. Auto-loads when validating schemas, parsing data, validating forms, checking types at runtime, or using z.object/z.string/z.infer in TypeScript.

typescript-import-style

9
from jpoutrin/product-forge

Merge-friendly import formatting (one-per-line, alphabetical). Auto-loads when writing TypeScript/JavaScript imports to minimize merge conflicts in parallel development. Enforces consistent grouping and sorting.

setup-mcp-auth

9
from jpoutrin/product-forge

Configure authentication for an existing FastMCP server

fastmcp

9
from jpoutrin/product-forge

FastMCP TypeScript framework patterns for MCP servers. Auto-loads when building MCP servers, creating tools/resources/prompts, implementing authentication, configuring transports, or working with FastMCP in TypeScript.

add-mcp-tool

9
from jpoutrin/product-forge

Add a new tool to an existing FastMCP server with guided configuration

add-mcp-resource

9
from jpoutrin/product-forge

Add a new resource or resource template to an existing FastMCP server

plan-with-team

9
from jpoutrin/product-forge

Validate plan file ownership

privacy-compliance

9
from jpoutrin/product-forge

GDPR, CCPA, and privacy compliance guidance for data protection. Use when handling personal data, implementing consent management, or ensuring regulatory compliance across jurisdictions.

oauth

9
from jpoutrin/product-forge

OAuth 2.0 and OpenID Connect implementation patterns. Use when implementing authentication, authorization flows, or integrating with OAuth providers like Google, GitHub, or custom identity providers.

mcp-security

9
from jpoutrin/product-forge

Use when securing MCP servers, preventing prompt injection, implementing authorization, validating user input, or building secure multi-agent pipelines. Provides 5-layer defense architecture patterns.

rag-cag-security

9
from jpoutrin/product-forge

Security patterns for RAG and CAG systems with multi-tenant isolation. Use when building retrieval-augmented or cache-augmented generation systems that require tenant isolation, access control, and secure data handling.

chunking-strategies

9
from jpoutrin/product-forge

Document chunking strategies for RAG systems. Use when implementing document processing pipelines to determine optimal chunking approaches based on document type and retrieval requirements.