
If you've been using git for a while, you know the pain. You're deep in a feature branch, your editor has 15 files open, you've got half a dozen terminals running tests, and suddenly you need to fix a critical bug on main. What do you do?
Stash your changes? Switch branches? Risk losing your context? Repeat the whole thing when you're done?
For the longest time, I thought this was just part of development. Then I discovered git worktrees, and combined them with AI tools like Cursor and Claude — it completely transformed how I work.
The Problem: Context Switching Kills Productivity
Traditional git workflows force you into sequential work. One branch at a time. Want to review a PR while working on a feature? Stop what you're doing. Want to test something on main while developing? Stash, switch, test, switch back, unstash.
This friction adds up. Every branch switch costs you mental energy, time, and flow state. And when you're working with AI coding tools? It gets worse — you can only run one AI agent at a time in a single repository.
Enter Git Worktrees
Git worktrees let you have multiple branches checked out simultaneously in different directories. Think of it as having multiple copies of your project, each on a different branch, but all sharing the same git history.
Here's the game-changer: Each worktree can have its own:
- Open editor instance
- Running dev server
- AI coding session
- Terminal sessions
No more stashing. No more switching. Just jump between folders and work in parallel.
Meet gtr: Git Worktree Runner
Raw git worktree commands are verbose and manual. Creating a worktree looks like this:
git worktree add ../my-project-feature feature
cd ../my-project-feature
cursor .Do this a few times and you'll never use worktrees again.
That's where gtr (Git Worktree Runner) comes in. It's a CLI wrapper that makes git worktrees actually usable for modern development workflows, with built-in AI tool integration. Created by the team at Coderabbit, gtr has become an essential part of my workflow.
My Setup
Here's my actual configuration:
# Set default editor (I use Cursor)
git gtr config set gtr.editor.default cursor
# Set default AI tool (Claude)
git gtr config set gtr.ai.default claude
# Automatically run npm install when creating new worktrees
git gtr config add gtr.hook.postcreate "npm i --force"
# Prefix worktree folders for easy identification
git gtr config set gtr.worktrees.prefix wt-Daily Workflow
This is what my development workflow looks like now:
# Start a new feature with AI
git gtr new feature/auth --editor --ai
# Creates: wt-feature-auth/
# Opens Cursor
# Starts Claude AI session
# Start another feature
git gtr new fix/bug-123 --editor --ai
# Creates: wt-fix-bug-123/
# Opens second Cursor instance
# Starts second Claude session
# List all worktrees
git gtr list
# Shows all branches and their status
# Run tests in a worktree
git gtr run feature-auth npm test
# Clean up when done
git gtr rm feature-authOne command. Everything set up. No manual file copying, no context switching.
Parallel AI Development: The Real Game Changer
This is where gtr shines for AI-assisted development. You can run multiple AI coding tools simultaneously, each working on a different branch.
I regularly have 3-4 AI agents working in parallel:
- One fixing a bug on
fix/checkout-issue - One implementing a new feature on
feature/ai-analytics - One refactoring on
refactor/api-cleanup - One running tests on
main
Each worktree has its own isolated Cursor instance with Claude active. No more stopping one AI session to start another. No more context pollution between tasks.
Here's what that looks like in practice:
# Terminal 1
git gtr new feature/user-dashboard --editor --ai
# Claude helps build dashboard components
# Terminal 2 (simultaneous)
git gtr new fix/payment-bug --editor --ai
# Claude helps debug payment flow
# Terminal 3 (simultaneous)
git gtr new feature/email-templates --editor --ai
# Claude generates email templatesThree AI agents. Three branches. Zero friction.
Real-World Example
Working on Clevylinks (our logistics platform), I recently had to:
- Implement user authentication
- Fix a shipping calculation bug
- Update documentation
- Prepare for a demo
With traditional git? That's 4 separate sprints. With gtr + AI?
git gtr new feature/auth --editor --ai
git gtr new fix/shipping-calc --editor --ai
git gtr new docs/update --editor --ai
git gtr new prepare/demo --editor --ai
# All 4 Cursor instances open
# All 4 Claude sessions running
# Switch between them as neededCompleted everything in one day instead of four.
Productivity Benefits I Actually See
Since integrating git worktrees with gtr and AI tools, I've noticed tangible improvements:
No More Stashing: I haven't used git stash in months. No more lost work or forgotten stashes.
Context Preservation: Each worktree maintains its own editor state, terminal history, and AI session context. Switch between tasks without losing flow.
Continuous Development: Run tests on main while building features on branches. Review PRs without stopping your own work.
Clean Separation: Each feature gets its own isolated environment. No accidental commits to wrong branches, no conflicting changes.
AI Parallelism: Multiple AI agents working simultaneously is the biggest productivity booster I've found since adopting AI coding tools.
Getting Started
Ready to try it out?
Installation
git clone https://github.com/coderabbitai/git-worktree-runner.git
cd git-worktree-runner
./install.shOne-Time Configuration
Set up your defaults:
git gtr config set gtr.editor.default cursor
git gtr config set gtr.ai.default claude
git gtr config add gtr.hook.postcreate "npm install"Your First Worktree
cd your-project
git gtr new my-first-feature --editor --aiThat's it. gtr creates the worktree, opens Cursor, starts Claude, and runs npm install automatically.
Beyond the Basics
gtr has more features for power users:
Copy Config Files: Automatically copy .env.example, config files, or any pattern to new worktrees:
git gtr config add gtr.copy.include "**/.env.example"
git gtr config add gtr.copy.exclude "**/.env"Run Commands Anywhere: Execute commands in specific worktrees without switching directories:
git gtr run my-feature npm run build
git gtr run 1 git status # Run in main repoClean Up: Remove worktrees for merged PRs automatically:
git gtr clean --mergedThe Bottom Line
Git worktrees with gtr and AI integration transformed my development workflow from sequential and friction-heavy to parallel and fluid. I can work on multiple features simultaneously, run multiple AI agents in parallel, and never lose context.
If you're serious about productivity with modern AI tools, give it a try. The combination of git worktrees + gtr + Cursor AI is surprisingly powerful — and once you experience true parallel development, you won't want to go back.
Resources:
Happy coding — in parallel.