Skip to main content

Initial Git Worktree Support

· 2 min read
Justin Handley
Full-stack TS Developer

We're excited to introduce Git worktree management commands in AI CLI. These new features make it easier to work with multiple branches simultaneously, improving your development workflow.

New Features

Worktree Management

The new worktree command creates isolated Git worktrees for parallel development:

ai worktree <branch1> <branch2> ...

Key features:

  • Creates multiple worktrees in parallel
  • Optional dependency installation with -p/--pnpm flag
  • Automatic Cursor instance launching
  • Clean directory structure
  • Safe branch creation

Worktree Merging

The new worktree-merge command simplifies merging changes from worktrees:

ai worktree-merge <branch>

Key features:

  • Merges changes from a worktree into main
  • Handles uncommitted changes
  • Cleans up worktrees and branches
  • Provides clear feedback
  • Safe merge process

Example Usage

  1. Create multiple worktrees:
ai worktree feature-a feature-b feature-c
  1. Create worktrees and install dependencies:
ai worktree -p feature-a feature-b
  1. Merge changes from a worktree:
ai worktree-merge feature-a

When to Use

These commands are perfect for:

  • Running multiple AI agents in parallel
  • Experimenting with different approaches
  • Testing multiple solutions simultaneously
  • Managing complex feature branches
  • Rapid prototyping and iteration

Installation

Update to the latest version:

npm install -g @justinhandley/ai-cli@latest

Or using pnpm:

pnpm install -g @justinhandley/ai-cli@latest

What's Next?

We're working on more features to enhance your development workflow. Stay tuned for updates!

Feedback

We'd love to hear your thoughts on the new worktree commands. Feel free to:

  • Try them out and let us know if you encounter any issues
  • Suggest improvements or additional features
  • Share your use cases and success stories

You can reach us through: