























The rename happened on November 10, 2025. The default branch of
rust-lang/rustis now namedmain.
We will be renaming the default branch of the rust-lang/rust repository from master to main on 2025-11-10. We've chosen main specifically as it's the default for newly-created repositories in GitHub and the renaming will leverage the GitHub tooling built to make this easier.
If you maintain a tool that currently assumes the default branch of rust-lang/rust is named master, using HEAD instead will work both before and after the rename.
After the rename, contributors will need to run a few git commands in their local checkout of the repository to update. Note that the specific commands that should be executed might differ based on the way you use git and how your local checkout is configured. We provide a guide below that we think should work for most use-cases, but your mileage may vary.
Please try to follow the guide step-by-step, and if you run into any problems, feel free to ask in this Zulip channel.
If you have a fork of the rust-lang/rust repository on GitHub, you should first update its default branch name before continuing. If you do not rename it and later run git checkout master, git will create a master branch based on your fork's outdated master branch, which can be confusing. Some of the following git commands in this post might also not work as expected.
Here is how you can update your fork's default branch:
https://github.com/<your-username>/rust/settingsmain.Execute the following git commands in your local checkout of the rust repository.
Note that the instructions below make two assumptions:
upstream that points to the rust-lang/rust repository and a remote called origin that points to your <username>/rust fork. Please update the commands accordingly if you use a different setup.
git remote -v command.master branch tracks the default branch of your fork, not the default branch of the upstream rust-lang/rust repository. If that is not the case, execute the commented git branch command instead.
master branch tracks by using git branch -vv --contains master (the tracked branch should be shown in square brackets).# Update the local branch name
git branch --move master main
# Update local references to your <username>/rust fork
git fetch origin
git branch --set-upstream-to=origin/main main # If your main branch tracks your fork
git remote set-head origin --auto
# Update local references relevant to the upstream rust-lang/rust repository
git fetch upstream
#git branch --set-upstream-to=upstream/main main # If your main branch tracks the upstream repo
git remote set-head upstream --auto
# Remove old branch names (optional, but recommended)
git remote prune origin
git remote prune upstream
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。