鉴于no wide agreement上有the semantics of master
,我们正在考虑在master
服务器上根本没有名为origin
的分支。
对于标准git
命令行客户端内置的默认值,会产生什么后果?它如何将名为master
的分支与其他分支(本地和远程分支)区别对待?
答案 0 :(得分:3)
根据我对代码库的调查以及我对没有master
分支的存储库的经验,我说你明白了。
最糟糕的情况是,一些不明确的边缘情况会导致命令失败而不是回退到master
分支。
git clone
设置master
分支,但未找到远程引用并且未指定--bare
标记(builtin/clone.c)git fast export
标记的--anonymize
单独留下master
,因为它是一个众所周知的默认值,并且不会与任何内容进行通信(built-in/fast-export.c)< / LI>
git init
使用master
作为默认分支名称(builtin/init-db.c)git submodule
默认为master
{3}} (来自下方的git-remote.c
和files-backend.c
输出实际上并未与master
分支互动)
上面的列表是使用builtin/submodule--helper.c上的git grep
编译的。{/ p>
# Look for string literals within *.c files containing "master"
# with 10 lines of context, excluding the t/ and contrib/ directories
$ git grep -C 10 -E -e \".*master.*\" -- :**/*.c :^t/ :^contrib/
答案 1 :(得分:1)
master
在某些地方用作默认值。
master
分支中完成的。master
但除了这种东西之外,一个名为master
的分支并不是必需的。