let’s say I have the following config file
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "origin"]
url = ssh://origin.com
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "faraway"]
url = ssh://faraway.com
fetch = +refs/heads/*:refs/remotes/faraway/*
if I do git checkout master; git pull origin then:
fetchwill runmergewill merge the fetched branch with my current branch.
If I run git checkout master; git pull faraway, then will git-merge merge anything? After all, I am pulling from a different remote than the configured remote.
The
remote = originspecifies the default behavior for pull (fetch actually) when you are in the branch. So when you dogit pull, the remote is origin ( which is also the default i.e even if the remote was not specified, it would have pulled from origin. If some other remote was specified, that remote would have been fetched.)And when you do
git pull faraway, it will fetch the faraway branches but will not merge ( as faraway is not the configured remote) it in the current branch master, unless you dogit pull faraway master