Skip to content

Master 对比主要

一句话解释

主要 and master 是两者都 conventional names for 默认分支. 主要是 modern 标准, replacing master for inclusive language.

用大白话说

Historically, Git named 默认分支 master 当你 ran git init. In 2020, Git community and major hosting platforms (GitHub, GitLab, Bitbucket) adopted main as the new default for inclusive language, avoiding the master/slave terminology.

Technically, there is no difference — both are just branch names. The default is configured by init.defaultBranch in your Git config. New repositories on GitHub default to 主要; older repositories may still use master.

When cloning or contributing to a project, check which name is used with git 分支. Some commands and scripts may assume one name; always verify. You can rename with git 分支 -m master 主要 to switch.

示例

bash
# Check current default branch name
git branch

# Rename master to main
git branch -m master main

# Set default for new repos
git config --global init.defaultBranch main

主要 and master 是只是 names. 主要是 modern 默认.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表