AIRGAP StudioAIRGAP Studio

Worktrees

Set up parallel work environments with AIRGAP Assistant's Worktree feature

Overview

Git Worktree lets you check out multiple branches simultaneously from a single Git repository, each in its own independent working directory. AIRGAP Assistant is worktree-aware — it navigates and modifies files according to each worktree's context.

Why Use Worktrees?

Normally, switching branches requires committing or stashing your current work. With worktrees, you can work on multiple branches simultaneously without this overhead.

ScenarioTraditional ApproachWorktree Approach
Urgent bugfix during feature developmentstash → switch branch → fix → switch backFix immediately in a separate worktree
Parallel development of two featuresAlternate between branchesWork simultaneously in each worktree
Maintaining main work during code reviewWork interruption requiredReview in a dedicated worktree

Creating and Managing Worktrees

Create worktrees from the terminal with the following commands.

# Create a worktree with a new branch
git worktree add ../my-feature feature-branch

# Create a worktree from an existing branch
git worktree add ../hotfix hotfix/login-bug

# List current worktrees
git worktree list

# Remove a worktree
git worktree remove ../my-feature

Open the created worktree folder in a separate AIRGAP Studio window for an independent work environment.

.worktreeinclude Configuration

The .worktreeinclude file lets you specify which files and folders the AI assistant should reference within a worktree. Create this file at the project root and list inclusion patterns, one per line.

# .worktreeinclude example
src/
tests/
package.json
tsconfig.json
*.md

Note: Files not specified in .worktreeinclude are excluded from the AI's context. This reduces unnecessary file scanning in large projects and improves AI response accuracy.

Syntax Rules

  • Directories end with / (e.g., src/)
  • Wildcard patterns are supported (e.g., *.ts, docs/**/*.md)
  • Lines starting with # are treated as comments
  • Blank lines are ignored

Tips

  • Place a separate .airgaprules in each worktree to apply AI rules tailored to each type of work.
  • Git history is shared across worktrees, so commits made in one are also visible from others.
  • Clean up finished worktrees with git worktree remove to free disk space.