Skip to main content

> cat ./x_thread.md

[terminal_mode]

Parallel Development with Git Worktrees and AI Agents

DATE:2025-11-19|FORMAT:x_twitter_thread
Nelson Lourenço's avatar
Nelson Lourenço@nelsonstr
20 tweets in this thread
📅 2025-11-19
tweet #11/20

# Git Worktrees: Run Parallel AI Agents Without Conflicts 🧵

❤️426🔁50💬13📅2025-11-19
tweet #22/20

Ever tried running multiple AI coding assistants at once? It's a nightmare. One overwrites the other's changes.

❤️426🔁50💬13
tweet #33/20

Enter **Git Worktrees** - a game changer for AI-assisted development.

❤️426🔁50💬13
tweet #44/20

**What are Git Worktrees?**

❤️426🔁50💬13
tweet #55/20

Native Git feature (since v2.5) that lets you manage multiple working trees from ONE repository.

❤️426🔁50💬13
tweet #66/20

Instead of cloning your repo multiple times (wasting disk space), worktrees check out different branches into separate directories - all linked to the same .git history.

❤️426🔁50💬13
tweet #77/20

**Why it Matters for AI Development:**

❤️426🔁50💬13
tweet #88/20

1. **Isolation**: Each AI agent in its own directory 2. **No Conflicts**: Worktree 1 changes don't touch Worktree 2 3. **Shared History**: All commits go to the same repo immediately

❤️426🔁50💬13
tweet #99/20

**Cheat Sheet:**

❤️426🔁50💬13
tweet #1010/20

```bash # Create a worktree git worktree add ../feature-login feature/login-page

❤️426🔁50💬13
tweet #1111/20

# List all worktrees git worktree list

❤️426🔁50💬13
tweet #1212/20

# Remove when done git worktree remove ../feature-login ```

❤️426🔁50💬13
tweet #1313/20

**Tool Integrations:**

❤️426🔁50💬13
tweet #1414/20

- **Claude Code**: Officially recommends worktrees for parallel sessions - **Cursor**: Uses worktrees for parallel "Agent" mode - **Antigravity**: Built "agent-first" with worktree support - **Kilo Code**: "Parallel Mode" automatically spins up ephemeral worktrees - **RooCode**: Explicit worktree management from UI

❤️426🔁50💬13
tweet #1515/20

**A Day with Worktrees:**

❤️426🔁50💬13
tweet #1616/20

1. Morning: Triage issues 2. Dispatch: - Kilo Code → "Fix #102" → spawns worktree/fix-102 - Claude → "Refactor logging" → spawns worktree/refactor-logging 3. Focus: You work in main, building dashboard 4. Review: Agents ping when PRs are ready 5. Merge: One click to integrate all parallel work

#102
❤️426🔁50💬13
tweet #1717/20

Move from "Single-Threaded" to "Multi-Process" development - with you as the orchestrator.

❤️426🔁50💬13
tweet #1818/20

**Ready to try?**

❤️426🔁50💬13
tweet #1919/20

```bash git worktree add ../my-feature feature/my-new-feature ```

❤️426🔁50💬13
tweet #2020/20

#Git #AI #Coding #Productivity

#Git#AI#Coding#Productivity
❤️426🔁50💬13
❤️426 likes🔁50 retweets💬13 replies
View on X →