Skip to content

Comments

Block rename-prefix from running in git worktrees#1792

Merged
steveyegge merged 1 commit intosteveyegge:mainfrom
sjsyrek:fix/rename-prefix-worktree-1645
Feb 16, 2026
Merged

Block rename-prefix from running in git worktrees#1792
steveyegge merged 1 commit intosteveyegge:mainfrom
sjsyrek:fix/rename-prefix-worktree-1645

Conversation

@sjsyrek
Copy link
Contributor

@sjsyrek sjsyrek commented Feb 16, 2026

Summary

Block bd rename-prefix from running inside git worktrees, where it would export renamed issues to the main worktree's JSONL file, leaving the current worktree's JSONL stale.

Fixes #1645

Changes Made

  • Added worktree detection guard in rename_prefix.go — detects worktree at command start and exits with a helpful error directing users to run from the main repository
  • Follows the same established pattern as init.go:168-186 which blocks bd init in worktrees

Backward Compatibility

Maintained: Only adds a guard for an unsupported scenario that previously produced incorrect results
Same behavior: Running from main repository works exactly as before

Technical Details

findJSONLPath() always resolves to the main worktree's JSONL because beads.db only exists there. Running rename-prefix from a worktree would rename issues in the shared DB and export to the main worktree's JSONL, leaving the current worktree's JSONL with stale (old-prefix) issue IDs. The fix blocks this at the command level with a clear error message.

Size: Small ✓

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 [email protected]

@steveyegge steveyegge merged commit 180030c into steveyegge:main Feb 16, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rename-prefix in git worktree updates main worktree's JSONL but not the current worktree's

2 participants