推送时分支名称发生冲突

Branch name clashes when pushing

我认为我知道的

当我从远程存储库中克隆或获取时,远程名称以从该远程导入的分支名称为前缀。
例如,如果远程在我的存储库中被称为 origin,那么在克隆远程的 master 分支之后在我的存储库中被称为 origin/master

此行为可确保导入的分支与我的存储库中已存在的分支之间永远不会发生名称冲突(无论它们是在本地创建的还是从其他存储库导入的)。

我不知道的(即我的问题)

当我推送到远程存储库时,我的存储库名称(在远程存储库中)是否以被推送的分支名称为前缀?

如果不是,如何避免分支名称冲突?

What I think I know

When I clone or fetch from a remote repository, the name of the remote is prefixed to the names of the branches imported from this remote.

For instance, if the remote is called origin in my repository, then after cloning the remote's master branch is called origin/master in my repository.

不完全是这样。
当您克隆 git 存储库 git 时,您会 reference 所有分支但只有 master 被签出

每次签出一个分支 git 添加一个 track 分支

When I push to a remote repository, is my repository name prefixed (in the remote repository) to the names of the branches that get pushed?

每当您键入 push git 时,都会使用一种名为 refspec

的内部机制

refspec

The format of the refspec is an optional +, followed by <src>:<dst>, where <src> is the pattern for references on the remote side and <dst> is where those references will be written locally.
The + tells Git to update the reference even if it isn’t a fast-forward.

更多阅读:
https://www.atlassian.com/git/tutorials/refs-and-the-reflog#refspecs