Skip to main content

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:

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 directories
  • git worktree list doesn’t show them
  • Disk space consumed
Solution:
Automatic Cleanup:

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:
  1. Keep main branch updated:
  2. Rebase before merging:
  3. Use small, focused tasks:
    • Smaller changes = fewer conflicts
    • Complete tasks quickly
  4. 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:
Configure Auto-cleanup:

Slow Worktree Creation

Problem: Creating worktrees takes very long Causes & Solutions:

Debug Mode

Enable worktree debugging to diagnose issues:

Manual Worktree Management

If Forge’s automatic worktree management fails, use git directly:

Create Worktree Manually

List All Worktrees

Remove All Worktrees


Recovery Procedures

Corrupted Worktree

Problem: Worktree is corrupted and won’t work Solution:

Complete Reset

Problem: Worktree system completely broken Solution:

Next Steps

Common Issues

General troubleshooting guide

API Errors

API connection problems

Git Worktree Docs

Learn how git worktrees work in Forge

Discord Support

Get help from the community