docs: explain sync-branch worktree behavior (GH#510)

Add comprehensive documentation about beads-created worktrees:
- New section in WORKTREES.md explaining why and where beads creates worktrees
- Common confusion: 'beads took over main!' with solution
- Troubleshooting entries for 'branch already checked out' errors
- FAQ entry: 'Why did beads create worktrees in my .git directory?'

This addresses user confusion when beads' sync-branch feature creates
internal worktrees that can lock branches users want to checkout.

Closes #510

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-14 17:20:12 -08:00
parent ee8fe2bbb7
commit 344fc1b95d
3 changed files with 205 additions and 2 deletions

View File

@@ -426,7 +426,33 @@ bd ready
bd create "Fix bug" -p 1
```
See [ADVANCED.md#git-worktrees](ADVANCED.md#git-worktrees) for details.
See [WORKTREES.md](WORKTREES.md) for details.
### Why did beads create worktrees in my .git directory?
Beads automatically creates git worktrees when using the **sync-branch** feature. This happens when you:
- Run `bd init --branch <name>`
- Set `bd config set sync.branch <name>`
The worktrees allow beads to commit issue updates to a separate branch without switching your working directory.
**Location:** `.git/beads-worktrees/<sync-branch>/`
**Common issue:** If you see "branch already checked out" errors when switching branches, remove the beads worktrees:
```bash
rm -rf .git/beads-worktrees
rm -rf .git/worktrees/beads-*
git worktree prune
```
**To disable sync-branch (stop worktree creation):**
```bash
bd config set sync.branch ""
```
See [WORKTREES.md#beads-created-worktrees-sync-branch](WORKTREES.md#beads-created-worktrees-sync-branch) for full details.
### What's the difference between SQLite corruption and ID collisions?