auto-claude: subtask-1-1 - Add --no-track flag to git worktree add command (#1455)
Prevents new worktree branches from inheriting upstream tracking from the base ref (e.g., origin/main). This ensures users can push with -u to correctly set up tracking to their own remote branch instead of incorrectly tracking the base branch. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -434,7 +434,10 @@ async function createTerminalWorktree(
|
||||
}
|
||||
|
||||
if (createGitBranch) {
|
||||
execFileSync(getToolPath('git'), ['worktree', 'add', '-b', branchName, worktreePath, baseRef], {
|
||||
// Use --no-track to prevent the new branch from inheriting upstream tracking
|
||||
// from the base ref (e.g., origin/main). This ensures users can push with -u
|
||||
// to correctly set up tracking to their own remote branch.
|
||||
execFileSync(getToolPath('git'), ['worktree', 'add', '-b', branchName, '--no-track', worktreePath, baseRef], {
|
||||
cwd: projectPath,
|
||||
encoding: 'utf-8',
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
|
||||
Reference in New Issue
Block a user