feat: add Git worktree compatibility (PR #478)
Adds comprehensive Git worktree support for beads issue tracking: Core changes: - New internal/git/gitdir.go package for worktree detection - GetGitDir() returns proper .git location (main repo, not worktree) - Updated all hooks to use git.GetGitDir() instead of local helper - BeadsDir() now prioritizes main repository's .beads directory Features: - Hooks auto-install in main repo when run from worktree - Shared .beads directory across all worktrees - Config option no-install-hooks to disable auto-install - New bd worktree subcommand for diagnostics Documentation: - New docs/WORKTREES.md with setup instructions - Updated CHANGELOG.md and AGENT_INSTRUCTIONS.md Testing: - Updated tests to use exported git.GetGitDir() - Added worktree detection tests Co-authored-by: Claude <noreply@anthropic.com> Closes: #478
This commit is contained in:
@@ -38,32 +38,33 @@ bd init --branch beads-metadata
|
||||
|
||||
This creates a `.beads/` directory and configures beads to commit to `beads-metadata` instead of `main`.
|
||||
|
||||
**Important:** After initialization, commit the beads configuration to your protected branch:
|
||||
**Important:** After initialization, you'll see some untracked files that should be committed to your protected branch:
|
||||
|
||||
```bash
|
||||
# The .beads/.gitignore uses a whitelist - only tracked files show up
|
||||
git add .beads/ .gitattributes
|
||||
# Check what files were created
|
||||
git status
|
||||
|
||||
# Commit the beads configuration to your protected branch
|
||||
git add .beads/.gitignore .gitattributes
|
||||
git commit -m "Initialize beads issue tracker"
|
||||
git push origin main # Or create a PR if required
|
||||
```
|
||||
|
||||
**Files created by `bd init --branch`:**
|
||||
|
||||
Files committed to your **protected branch** (main):
|
||||
- `.beads/.gitignore` - Whitelist of tracked files (everything else ignored)
|
||||
Files that should be committed to your protected branch (main):
|
||||
- `.beads/.gitignore` - Tells git what to ignore in .beads/ directory
|
||||
- `.gitattributes` - Configures merge driver for intelligent JSONL conflict resolution
|
||||
|
||||
Files committed to your **sync branch** (beads-metadata) by the daemon:
|
||||
- `.beads/issues.jsonl` - Issue data in JSONL format
|
||||
- `.beads/metadata.json` - Metadata about the beads installation
|
||||
- `.beads/config.yaml` - Configuration settings
|
||||
- `.beads/README.md` - Documentation for contributors
|
||||
Files that are automatically gitignored (do NOT commit):
|
||||
- `.beads/beads.db` - SQLite database (local only, regenerated from JSONL)
|
||||
- `.beads/daemon.lock`, `daemon.log`, `daemon.pid` - Runtime files
|
||||
- `.beads/beads.left.jsonl`, `beads.right.jsonl` - Temporary merge artifacts
|
||||
|
||||
Files that are **automatically ignored** (local only, never committed):
|
||||
- `.beads/beads.db` - SQLite database (regenerated from JSONL)
|
||||
- `.beads/daemon.*` - Runtime files (lock, log, pid, socket)
|
||||
- `.beads/beads.*.jsonl` - Temporary merge artifacts
|
||||
- Everything else in `.beads/` not explicitly whitelisted
|
||||
The sync branch (beads-metadata) will contain:
|
||||
- `.beads/beads.jsonl` - Issue data in JSONL format (committed automatically by daemon)
|
||||
- `.beads/metadata.json` - Metadata about the beads installation
|
||||
- `.beads/config.yaml` - Configuration template (optional)
|
||||
|
||||
**2. Start the daemon with auto-commit:**
|
||||
|
||||
@@ -111,19 +112,17 @@ your-project/
|
||||
**What lives in each branch:**
|
||||
|
||||
Main branch (protected):
|
||||
- `.beads/.gitignore` - Whitelist of tracked files
|
||||
- `.beads/.gitignore` - Tells git what to ignore
|
||||
- `.gitattributes` - Merge driver configuration
|
||||
|
||||
Sync branch (beads-metadata):
|
||||
- `.beads/issues.jsonl` - Issue data (committed by daemon)
|
||||
- `.beads/beads.jsonl` - Issue data (committed by daemon)
|
||||
- `.beads/metadata.json` - Repository metadata
|
||||
- `.beads/config.yaml` - Configuration settings
|
||||
- `.beads/README.md` - Documentation
|
||||
- `.beads/config.yaml` - Configuration template
|
||||
|
||||
Not tracked (gitignored via whitelist):
|
||||
Not tracked (gitignored):
|
||||
- `.beads/beads.db` - SQLite database (local only)
|
||||
- `.beads/daemon.*` - Runtime files
|
||||
- Everything else not in the whitelist
|
||||
|
||||
**Key points:**
|
||||
- The worktree is in `.git/beads-worktrees/` (hidden from your workspace)
|
||||
|
||||
Reference in New Issue
Block a user