Repository navigation
fix(#343): auto-detect default branch instead of hardcoding origin/main - #345
Merged
admarble merged 2 commits intoMar 11, 2026
Merged
Conversation
Add detectDefaultBranch() that reads origin/HEAD symbolic ref, falls back to `git remote set-head origin --auto`, then to "main". Wire it into the resolution chain so --base flag, settings.run.defaultBase, and auto-detection all work. Update rebaseBeforePR(), checkWorktreeFreshness(), and pr-status helpers to accept a baseBranch parameter instead of hardcoding "origin/main". Fixes #343
Replace hardcoded "main" in user-facing stale worktree warnings with the resolved detectedBase variable.
9 tasks
admarble
deleted the
feature/343-bug-run-worktree-creation-and-rebase-hardcode-
branch
March 11, 2026 14:05
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
detectDefaultBranch()utility that readsorigin/HEADsymbolic ref (no network), falls back togit remote set-head origin --auto, then to"main"--baseflag →settings.run.defaultBase→ auto-detect →"main"rebaseBeforePR(),checkWorktreeFreshness(),ensureWorktree(), andpr-status.tshelpers to accept abaseBranchparameter instead of hardcoding"origin/main"runCommand,runIssueWithLogging,executeBatch)Test plan
detectDefaultBranch()(symbolic-ref, fallback, final default)rebaseBeforePR()uses custom base branch ("master") in fetch and rebase commands"origin/main"in code paths (only in comments updated to say "base branch")Fixes #343
🤖 Generated with Claude Code