-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Description
Opening this to solicit feedback on the question:
Should
LightGBMchange its default branch frommastertomain?
I promised @borchero like a year ago that I would open this 😬
Impact of renaming "master" to "main"
According to https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch and https://github.com/github/renaming, GitHub will handle many things for us:
- 🆗 most URLs with
/master/in them will automatically redirect to main, and in the UI GitHub will display a note saying it changed
example: https://github.com/dask/dask/blob/master/.git-blame-ignore-revs*
- 🆗 branch protection rules will automatically be updated
- 🆗 commit hashes and tags will be unchanged
- 🆗 PRs will automatically be re-targeted
But some things will break:
- ❌
raw.githubusercontent.comlinks will break - ❌ any
git pullexplicitly referencingmasterwill not work - ❌ external-to-this-repo guides referencing the
masterbranch may be incorrect (broken links, advice to usegitcommands that no longer work, etc.) - ❌ contributors may need to update their forks and local clones
Benefits
In exchange for those impacts, LightGBM would be consistent with a large proportion of other open source projects using git, including:
- all conda-forge feedstocks: https://conda-forge.org/news/2022/02/13/default-branch-migration-from-master-to-main/
- all Dask repos: Renaming
mastertomaindask/community#68 - all new GitHub repos by default: https://github.com/github/renaming
pandas: DISCUSS Rename master to main? pandas-dev/pandas#39577networkx,numpy,scikit-image: DISCUSS Rename master to main? pandas-dev/pandas#39577 (comment)scikit-learn: Question: Changing the default branch (master) tomain? scikit-learn/scikit-learn#17595scipy: DISCUSS Rename master to main? pandas-dev/pandas#39577 (comment)- many other popular projects in the
microsoft/org
This convention of main has become so common that I think at this point it's what contributors expect when the work on a git-based project. Even git itself will now warn when you create a new repo and use master as the default branch.
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /Users/jlamb/blegh/.gitApproach
I think this would go roughly like this:
- put up a PR changing all
masterreferences in source control (links, CI configs, etc.) tomain, get that approved - go into the repo settings and rename the default branch to
main - push a new commit to that PR to re-run all CI
- merge that PR
And then manually adding a note about this to the release notes of the next release.
Timing?
Proposing we do this as soon as we have agreement on this issue, ideally before the next release (which will probably be v4.7.0).
Notes
Tagging other maintainers for comment, whenever you have time.
@guolinke @shiyu1994 @StrikerRUS @jmoralez @borchero @btrotta