[FEATURE] Worktree creation should sync from remote default branch, not local
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When creating a Git worktree via the Claude Code Desktop App, the worktree is initialized from the local main branch rather than the remote one (or whichever branch is configured as the default).
This means that if the local main branch is behind the remote, the new worktree starts from a stale state. Unless I explicitly remember to instruct Claude to run git pull beforehand, I end up working on outdated code without any warning.
Proposed Solution
When creating a worktree, Claude Code should automatically fetch and sync from the remote default branch before initializing the worktree. This could be implemented in one of two ways:
- Default behavior: Always pull from the remote default branch when creating a worktree (safest option, ensures freshness).
- 2. Opt-in setting: Add a configuration option (e.g., in Claude Code settings) to enable automatic remote sync on worktree creation, for users who prefer explicit control.
Alternative Solutions
Currently, I work around this by manually instructing Claude to run git pull from main on the worktree branch. However, this is a manual step that is easy to forget, and there is no prompt or warning from Claude Code to remind me to do it. A built-in sync step would eliminate this friction entirely.
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
- A colleague merges several pull requests into
mainon the remote. - 2. My local
mainbranch is now behind the remote by several commits. - 3. I open Claude Code Desktop and ask it to create a new worktree to work on a new feature.
- 4. Claude Code creates the worktree from my stale local
main— without warning me. - 5. I spend time working on code that is missing recent changes, potentially causing merge conflicts or duplicated work later.
With this feature, Claude Code would automatically pull the latest changes from the remote before creating the worktree, ensuring I always start from an up-to-date state.
Additional Context
This issue is particularly relevant for teams where main moves quickly (e.g., CI/CD environments with frequent merges). Starting from a stale branch is a common source of unnecessary merge conflicts and wasted effort.
A similar pattern exists in other tools: for example, git worktree add itself does not auto-pull, but many IDE integrations (e.g., JetBrains, VS Code Git extensions) prompt or auto-fetch before branching. Claude Code could follow the same convention to provide a safer default experience.
This issue has 12 comments on GitHub. Read the full discussion on GitHub ↗