Overview
Forge uses git worktrees to isolate task execution. Each task runs in its own worktree, preventing conflicts and allowing parallel development. However, this can occasionally cause issues.Common Worktree Errors
Worktree Creation Failed
Problem:fatal: could not create worktree
Causes & Solutions:
Not a Git Repository
Not a Git Repository
Dirty Working Directory
Dirty Working Directory
Disk Space Issue
Disk Space Issue
Permission Error
Permission Error
Worktree Already Exists
Problem:fatal: worktree already exists
Solution:
Cannot Remove Worktree
Problem:fatal: worktree contains modified or untracked files
Solution:
Orphaned Worktrees
Problem: Worktree directories exist but git doesn’t know about them Symptoms:.forge/worktrees/has directoriesgit worktree listdoesn’t show them- Disk space consumed
Branch Issues
Branch Already Exists
Problem:fatal: a branch named 'forge/task-123' already exists
Solution:
Detached HEAD State
Problem: Worktree is in detached HEAD state Solution:Cannot Switch Branches
Problem:error: you need to resolve your current index first
Solution:
Merge Conflicts
Conflicts After Task Completion
Problem: Merge conflicts when merging worktree back to main Solution:1
Identify Conflicts
2
Resolve Conflicts
3
Mark as Resolved
4
Merge to Main
Preventing Merge Conflicts
Best Practices:-
Keep main branch updated:
-
Rebase before merging:
-
Use small, focused tasks:
- Smaller changes = fewer conflicts
- Complete tasks quickly
-
Coordinate with team:
- Avoid working on same files simultaneously
- Use task dependencies in Forge
Performance Issues
Too Many Worktrees
Problem: Hundreds of worktrees consuming disk space Solution:Slow Worktree Creation
Problem: Creating worktrees takes very long Causes & Solutions:Large Repository
Large Repository
Many Submodules
Many Submodules
Disk I/O Bottleneck
Disk I/O Bottleneck

