Skip to content

change default branch from 'master' to 'main'#7287

Merged
jameslamb merged 6 commits into
masterfrom
default-branch
Jul 10, 2026
Merged

change default branch from 'master' to 'main'#7287
jameslamb merged 6 commits into
masterfrom
default-branch

Conversation

@jameslamb

@jameslamb jameslamb commented May 19, 2026

Copy link
Copy Markdown
Member

In #7034, we have broad agreement amongst maintainers to change the default branch from master to main, for the reasons described there.

I talked with @guolinke and @shiyu1994 in the private maintainer chat about this too (reminder to other maintainers to please join that chat!) and they agreed with doing this close in time to when we moved out of the Microsoft/ org.

This proposes doing that.

This PR updates all references to master (except PR CI triggers, which should temporarily allow master and main).

After this PR

Once this has at least 2 approvals and is merged, I'll do all the remaining mostly-manual work to complete this migration, including updating all open PRs. See "Approach" in #7034 for a list of steps.

update: using GitHub's branch renaming, all open PRs will automatically be retargeted to main.

Expected Impact

copied from #7034

@jameslamb jameslamb changed the title WIP: change default branch from 'master' to 'main' change default branch from 'master' to 'main' May 19, 2026
@jameslamb jameslamb changed the title change default branch from 'master' to 'main' WIP: change default branch from 'master' to 'main' May 19, 2026
@jameslamb jameslamb changed the title WIP: change default branch from 'master' to 'main' change default branch from 'master' to 'main' May 25, 2026
@jameslamb jameslamb marked this pull request as ready for review May 25, 2026 04:33

@borchero borchero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! Just two questions :)

Comment thread .appveyor.yml
- '3.10'

# only build on 'master' and pull requests targeting it
# only build on 'master' / 'main' and pull requests targeting it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we keep master here?

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.

I believe we need it for CI on this PR to still be triggered.

So it could be removed as soon as this is merged and the default branch switches to main.

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.

I've put up a follow-up removing these: #7353

pull_request:
branches:
- main
- master

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Similar question: aren't all PRs immediately rebased after rename?

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.

@guolinke asked that we preserve master indefinitely (but just not update it any more), so I was thinking of doing this as changing the default branch not "renaming" master to main.

GitHub handles a lot with renaming (https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch), but the renaming does not extend to SSH-base git clones

$ git clone --branch master git@github.com:dask/distributed.git
Cloning into 'distributed'...
fatal: Remote branch master not found in upstream origin

But thinking about it some more, renaming via GitHub's feature for that (https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch) would be easier and seems like it's handle most redirections.

And I guess anyone directly trying to clone from master probably really wants "latest" and it'd be better to alert them to the need to update to main than for them to silently keep getting a frozen-in-time-branch.

@guolinke could you read that link and let me know if it'd be ok to rename master to main instead of preserving master?

I guess this is what other projects have done, e.g. if you go to https://github.com/dask/distributed/tree/master you'll be redirected to https://github.com/dask/distributed/tree/main.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, I'd be strongly in favor of renaming via GitHub's dedicated feature 😅

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.

I've asked @guolinke for his opinion in the private maintainer chat too. Hoping we can come to an agreement here and resolve this to make it part of the v4.7.0 release.

I know he's busy with other things and may be hard to reach.

If we don't hear back by July 25 (that'll have been 2 months), I'm comfortable moving forward with the "renaming" option and with the release. I always want to defer to Guolin's opinion on major things like this affecting the project, but we also need to keep the project moving forward and he already approved making the default branch main (it's only the exact mechanism that's a question here).

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.

Hey @borchero , Guolin approved doing the rename privately, so I'm ready to move forward with that approach. Thanks for the nudge!

I still think we need these master lines in GitHub Actions configurations temporarily to keep CI running on this PR (and then a follow-up PR to remove them).

I've also updated the plan in the "Approach" section of #7034

Could you take another look here and approve if you think the PR has all the changes we'd want on the default branch before making the switch?

Once you approve this, I'll merge it and work on all the other steps. And then we could hopefully be ready to do the release as soon as this week 😁

@jameslamb jameslamb requested a review from borchero June 18, 2026 03:19
@jameslamb

Copy link
Copy Markdown
Member Author

No other maintainer has clicked "approve" on this, but it has many other forms of approval:

Given all that, I feel comfortable using admin powers to merge this without an approval.

I just made the following changes to support that:

  • removed the ruleset on master that was conflicting with the classic branch protection (think this was inherited from Microsoft)
  • temporarily modified the branch protection on master to allow myself to merge without an approval

I'm sorry to do this, but we need to get a new release out in the next 20 days (#7352) and we'd agreed a long time ago to make this a part of the release alongside changing the GitHub org.

I know everyone has different challenges making time for LightGBM, but I hope in the future folks will be able to devote a bit more time to reviews here so things can move forward faster. I promise to use this power very sparingly in the future, but I'd be willing to do it again for other time-sensitive needs like security vulnerabilities or CRAN fix-this-or-get-archived threats.

@jameslamb jameslamb merged commit cf16013 into master Jul 10, 2026
77 of 79 checks passed
@jameslamb jameslamb deleted the default-branch branch July 10, 2026 02:54
@jameslamb

Copy link
Copy Markdown
Member Author

I've re-set the branch protection to again prevent admin merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants