worktree.baseRef: "head" creates worktree from default branch (main) instead of current branch
Summary
When worktree.baseRef is set to "head" in .claude/settings.local.json, new worktrees are created from the repository's default branch (main) instead of the user's current working branch.
Expected behavior
Per the schema description:
'head' branches from your current local HEAD so unpushed commits and feature-branch state are present.
When working on branch develop, a new worktree should be created from develop's HEAD.
Actual behavior
The worktree is created from main regardless of the current branch. Verified by comparing the worktree branch tip with main:
git log --oneline -3 claude/elated-darwin-16dfbc
# 27be31e chore(prod): sync from develop ← identical to main tip
git log --oneline -3 main
# 27be31e chore(prod): sync from develop ← same commit
The merge-base of the new worktree branch with develop was an older commit, not the current HEAD of develop.
Steps to reproduce
- Set up a repo with
mainanddevelopbranches (develop is ahead of main) - Set
"worktree": { "baseRef": "head" }in.claude/settings.local.json - Check out
develop - Enable the worktree checkbox in the Claude Code UI
- Observe that the new
claude/<name>branch starts frommain's HEAD, notdevelop's HEAD
Configuration
"worktree": {
"baseRef": "head"
}
Additional context
- Only two values are accepted by the schema:
"fresh"and"head" - Both values appear to result in worktrees based on
main(the default branch) "fresh"is described as branching fromorigin/<default-branch>— so the difference between"fresh"and"head"is unclear if both point tomain- No global settings override was present (
~/.claude/settings.jsonhad noworktreekey)
Suggestion
Either fix "head" to use the actual current branch's HEAD, or add a third option (e.g. "branch") that explicitly uses the current working branch.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗