Skip to content

Fetch from origin before creating new branch - #40

Merged
alexneyler merged 3 commits into
mainfrom
fix/pull
Mar 4, 2026
Merged

alexneyler merged 3 commits into
mainfrom
fix/pull

Conversation

@alexneyler

Copy link
Copy Markdown
Owner

What

fitz br new now fetches from origin before creating a worktree, so new branches always start from the latest remote state instead of the (potentially stale) local HEAD.

How

  • Added git fetch origin in BrNew before worktree creation
  • When no base is specified, defaults to origin/<defaultBranch> (detected via origin/HEAD, falling back to main)
  • If a base is explicitly provided, it is still used as-is

Testing

  • Added TestBrNewFetchesOriginAndUsesDefaultBase: sets up a bare repo, pushes a commit that the local clone doesn't have, then verifies BrNew creates the branch at the latest origin commit
  • All existing tests pass (make lint && make test)

alexneyler and others added 3 commits March 3, 2026 17:03
BrNew now runs 'git fetch origin' before creating the worktree so the
new branch starts from the latest remote state. When no base is
specified, it defaults to origin/<defaultBranch> instead of the local
HEAD.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CI runners may default to a different branch name (e.g. master),
causing 'git push origin main' to fail.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@alexneyler
alexneyler merged commit dc20eb9 into main Mar 4, 2026
1 check passed
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