Skip to content

feat(apps/create): detect Git main branch name#1201

Merged
EtienneM merged 2 commits intomasterfrom
feat/1124/detect_main_branch
Mar 11, 2026
Merged

feat(apps/create): detect Git main branch name#1201
EtienneM merged 2 commits intomasterfrom
feat/1124/detect_main_branch

Conversation

@EtienneM
Copy link
Copy Markdown
Member

@EtienneM EtienneM commented Mar 10, 2026

I tested both successful case

Fix #1124

  • Add a changelog entry in the section "To Be Released" of CHANGELOG.md

@EtienneM EtienneM self-assigned this Mar 10, 2026
@EtienneM EtienneM force-pushed the feat/1124/detect_main_branch branch 4 times, most recently from 445d664 to e246162 Compare March 10, 2026 16:17
@EtienneM EtienneM marked this pull request as ready for review March 10, 2026 16:17
@EtienneM EtienneM requested review from a team and sc-zenokerr and removed request for a team March 10, 2026 16:17
@EtienneM EtienneM force-pushed the feat/1124/detect_main_branch branch from e246162 to dd4b659 Compare March 11, 2026 08:32
Comment thread utils/git.go
}

// Try to resolve `origin/HEAD`
remoteOrigin, err := repo.Remote("origin")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question. Do we really need to hit the remote repository to determine the main/master branch?

I wonder if it might be better to try to resolve the main/master branch locally first (refs/remotes/origin), then fallback to remote.

WDYT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes you are right! Done in fa1612a

@EtienneM EtienneM requested a review from sc-zenokerr March 11, 2026 09:03
Copy link
Copy Markdown
Contributor

@sc-zenokerr sc-zenokerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

There's a slight edge case where the local has both main and master, where we don't know which is the true one, but I think that is ok.

@EtienneM EtienneM merged commit cf71055 into master Mar 11, 2026
7 checks passed
@EtienneM EtienneM deleted the feat/1124/detect_main_branch branch March 11, 2026 10:46
@EtienneM
Copy link
Copy Markdown
Member Author

There's a slight edge case where the local has both main and master, where we don't know which is the true one, but I think that is ok.

In this case we choose main. I think it's a reasonable choice as it's the new default

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.

Default branch is sometimes main instead of master

2 participants