hasanghaforian
hasanghaforian

Reputation: 14022

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

In Git-config you can see:

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.

But how Git can detect the repository which we normally pull from that?

Upvotes: 0

Views: 40

Answers (1)

torek
torek

Reputation: 488481

The "normal" repository for each branch is whatever is recorded under that branch's remote setting.

Suppose, for instance, that you are on branch feature3:

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

Now you check out branch bug7 instead; check its remote, and compare to feature3's setting:

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

If you are on branch bug7 and push, git is pushing to the "normal" repository if and only if you are pushing to whistles. If you are on branch feature3 and push, git is pushing to the "normal" repository if and only if you are pushing to bells.

Upvotes: 1

Related Questions