我正在阅读本教程https://www.atlassian.com/git/tutorials/syncing/git-fetch https://www.atlassian.com/git/tutorials/syncing/git-fetch
它包含一个添加远程存储库的示例
git remote add coworkers_repo [email protected] /cdn-cgi/l/email-protection:coworker/coworkers_repo.git
然后获取一个分支
git fetch coworkers_repo coworkers/feature_branch
fetching coworkers/feature_branch
在最后一个命令中,为什么分支名称“coworkers/feature_branch”的名称有一个正斜杠?分支不应该是一串字符,例如“coworkers”或“feature_branch”吗?或者我有什么遗漏的吗?
允许使用斜杠 (以及其他特殊字符 https://stackoverflow.com/questions/3651860/which-characters-are-illegal-within-a-branch-name),一些 Git UI 软件(例如 SourceTree)将使用它们对分支进行分组,就像在文件夹中一样。这会导致类似这样的结果:
coworkers
feature_branch1
feature_branch2
customers
feature_branch1
feature_branch2
As 基思·汤普森 https://stackoverflow.com/users/827263/keith-thompson指出,“一/二和一/二/三都是有效的分支名称,但不能在同一个存储库中同时拥有这两个名称。由于分支在 .git 目录树中的表示方式,这需要一个/两个既是常规文件又是目录。”
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)