Skip to content

Add support for git worktrees#746

Open
kpaxton wants to merge 1 commit into
bk201-:masterfrom
kpaxton:support-git-workspaces
Open

Add support for git worktrees#746
kpaxton wants to merge 1 commit into
bk201-:masterfrom
kpaxton:support-git-workspaces

Conversation

@kpaxton
Copy link
Copy Markdown

@kpaxton kpaxton commented May 30, 2024

  • Fix resolution of git root directory to support worktree folder structures
  • Use the resolved gitRoot path for commitmsg parsing and modification

* Fix resolution of git root directory to support worktree folder structures
* Use the resolved gitRoot path for commitmsg parsing and modification
@KalvinWillison
Copy link
Copy Markdown

KalvinWillison commented Apr 22, 2026

Tested this against a repo where I run Claude Code / CI work inside git worktree add-created worktrees — it correctly reads the worktree's own HEAD instead of the main checkout's. Reproducible on master today: the hook prepends the main checkout's ticket ID to commits made from a worktree, which is exactly the bug.

FWIW there's also #747 attempting the same fix — IMO this one (#746) is cleaner (relies on git's own worktree-aware --git-dir rather than adding an isInsideWorktree heuristic). Related: #749.

@bk201- — any chance of a look? This bug bites anyone using Claude Code, VS Code multi-root, or other tooling that encourages worktrees.

@rutgersc
Copy link
Copy Markdown

@bk201- Now with more usage of agents I can see this biting more users than before, could you look into this fix?

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.

3 participants