Skip to content

Infer the default branch during changeset init - #2246

Open
Boulea7 wants to merge 1 commit into
changesets:mainfrom
Boulea7:boulea7/changesets-807
Open

Infer the default branch during changeset init#2246
Boulea7 wants to merge 1 commit into
changesets:mainfrom
Boulea7:boulea7/changesets-807

Conversation

@Boulea7

@Boulea7 Boulea7 commented Aug 13, 2026

Copy link
Copy Markdown

Closes #807.

When changeset init asks for a base branch, it now reads the symbolic origin/HEAD and verifies that its target ref exists. It continues using main if Git is unavailable or the ref cannot be resolved. A branch entered at the prompt still takes precedence.

Focused tests cover non-main, missing, dangling, non-origin, unavailable-Git, and explicit-input cases. The focused 49 tests, build, typecheck, lint, and format checks pass.

The full suite reports 915 passing tests and one unchanged packages/write formatter-fixture failure: pnpm exec oxfmt exits with status 1 inside its isolated temporary workspace.

@netlify

netlify Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploy Preview for changesets ready!

Name Link
🔨 Latest commit 91be9fb
🔍 Latest deploy log https://app.netlify.com/projects/changesets/deploys/6a7d367ebaef4c000823e92e
😎 Deploy Preview https://deploy-preview-2246--changesets.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 91be9fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@changesets/cli Minor
@changesets/git Minor
@changesets/apply-release-plan Patch
@changesets/read Patch
@changesets/release-utils Patch
@changesets/get-release-plan Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.61%. Comparing base (b4dc91f) to head (91be9fb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2246      +/-   ##
==========================================
+ Coverage   84.53%   84.61%   +0.07%     
==========================================
  Files          80       80              
  Lines        3168     3184      +16     
  Branches      892      897       +5     
==========================================
+ Hits         2678     2694      +16     
  Misses        433      433              
  Partials       57       57              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@beeequeue

Copy link
Copy Markdown
Member

I'm not sure about this approach, there's no guarantee that the user will be on the default branch when they run changeset init and it would be confusing if we suggest the wrong default value.

@Andarist

Copy link
Copy Markdown
Member

Checking origin/HEAD should work OK (if done appropriately) regardless of your current branch. So the core of the idea seems to be fine to me - but I have not yet looked into the content of the PR.

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.

Determine baseBranch on init

3 participants