Why Worktrees Matter
Traditional AI coding workflows are sequential: give an AI a task, wait for it to finish, review, then start the next. This wastes time. With worktrees, while one AI builds a feature, you can have others tackling different tasks in parallel.| Component | Isolation |
|---|---|
| Git worktree | Each worktree has its own copy of the codebase |
| Terminal | Separate terminal instance per worktree |
| Branch | Each worktree works on its own branch |
| Ports | Configurable port assignments to avoid conflicts |
Worktrees share the same git history, but file changes are isolated until you merge.
Prerequisites
- A project added to Termpad
- Understanding of what you want the worktree to accomplish
Creating a New Worktree
Enter a branch name
Type a descriptive branch name. Good naming conventions:
feature/login-pagefix/null-pointer-errorrefactor/api-clientexperiment/new-caching
Choose a base branch
By default, new branches are based on
origin/main. Select a different base if needed.Worktree Anatomy
Each worktree includes:| Component | Description |
|---|---|
| Git worktree | Isolated copy of your codebase on a separate branch |
| Main terminal | Where you run your AI agent (Claude, Gemini, etc.) |
| User terminals | Additional terminals for dev servers, tests, etc. |
| File changes | Shows uncommitted changes in this worktree |
| Diff viewer | Review changes before committing |
Using an Existing Worktree
If you want to import worktrees that already exist:Worktree Workflow
A typical worktree workflow:Managing Multiple Worktrees
Create additional worktrees to work in parallel:Deleting a Worktree
When a worktree’s work is complete:Best Practices
Choose independent tasks
For best results, choose tasks that don’t overlap:- Good
- Avoid
- Worktree 1: Build login page
- Worktree 2: Build settings page
- Worktree 3: Add API rate limiting
One task per worktree
Keep worktrees focused on a single task. This makes:- Progress easier to track
- Changes easier to review
Use descriptive branch names
Your branch name should describe the work:| Type | Example |
|---|---|
| Feature | feature/user-authentication |
| Bug fix | fix/login-redirect-loop |
| Refactor | refactor/extract-api-client |
| Experiment | experiment/graphql-migration |
Clean up finished worktrees
Don’t let old worktrees accumulate. Delete them when:- The PR is merged
- You’ve decided not to pursue the work
- The experiment is complete