Git 如何检测您从中提取的普通存储库?

How does Git detect the normal repository which you pull from?

Git-config中可以看到:

simple - in centralized workflow, work like upstream with an added safety to refuse to push if the upstream branch’s name is different from the local one.

When pushing to a remote that is different from the remote you normally pull from, work as current.

但是 Git 如何检测我们通常从中提取的存储库?

每个分支的 "normal" 存储库是在该分支的 remote 设置下记录的任何内容。

例如,假设您在分支 feature3:

$ git config --get branch.feature3.remote
bells

现在您改为查看分支 bug7;检查它的遥控器,并与 feature3 的设置进行比较:

$ git checkout bug7
[...]
$ git config --get branch.bug7.remote
whistles
$ git config --get branch.feature3.remote
bells

如果您在分支 bug7 上推送,当且仅当您推送到 whistles 时,git 才会推送到 "normal" 存储库。如果您在分支 feature3 上推送,当且仅当您推送到 bells.

时,git 才会推送到 "normal" 存储库