Skip to content

feat(desktop): enable push.autoSetupRemote on worktree creation - #1267

Merged
saddlepaddle merged 1 commit into
mainfrom
set-upstream
Feb 7, 2026
Merged

saddlepaddle merged 1 commit into
mainfrom
set-upstream

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Feb 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Sets push.autoSetupRemote=true in each worktree's local git config after creation
  • The first git push now automatically creates the remote branch and sets upstream tracking (like git push -u origin <branch>)
  • Applied to all three worktree creation paths: new branch, existing branch, and PR checkout
  • Works alongside the existing ^{commit} trick which prevents the wrong upstream (origin/main) from being set

Test plan

  • Create a new workspace → verify git config --local push.autoSetupRemote returns true in the worktree
  • Run git push from the worktree terminal → verify it pushes and sets upstream without needing -u
  • Create workspace from existing remote branch → verify same behavior
  • Open a PR workspace → verify same behavior

Summary by CodeRabbit

  • New Features
    • Git worktrees now automatically configure remote push settings, allowing the first push to set up tracking without requiring the -u flag.

Set push.autoSetupRemote=true in each worktree's local git config so
the first `git push` automatically creates the remote branch and sets
upstream tracking, similar to `git push -u origin <branch>`.

Applied to all three creation paths: new branch, existing branch, and
PR checkout.
@coderabbitai

coderabbitai Bot commented Feb 7, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR adds automatic upstream branch configuration to three git worktree creation paths in the desktop app. After creating a worktree, the code now enables push.autoSetupRemote via local git config, allowing the first push to automatically set up the remote branch tracking without requiring explicit -u flags.

Changes

Cohort / File(s) Summary
Worktree Creation Config
apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts
Added git config --local push.autoSetupRemote true call (with 10s timeout) in three worktree creation paths: createWorktree, createWorktreeFromExistingBranch, and createWorktreeFromPr. Configuration is applied immediately after worktree creation and before logging.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 A worktree sprouts, configuration flows,
Push.autoSetupRemote now knows,
No -u flag required in sight,
Remote branches set just right! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description covers the core functionality, test plan, and context, but lacks formal sections matching the template structure (Description, Related Issues, Type of Change, Testing, Screenshots, Additional Notes). Reformat the description to follow the repository template: add a Description section, explicitly mark the Type of Change (New feature), format Testing as a proper section with narrative steps, and add Related Issues section if applicable.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling push.autoSetupRemote configuration on git worktree creation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch set-upstream

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@saddlepaddle
saddlepaddle merged commit 0144d26 into main Feb 7, 2026
6 checks passed
@github-actions

github-actions Bot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

@Kitenite
Kitenite deleted the set-upstream branch February 7, 2026 02:01
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.

1 participant