A git pull
basically does a git fetch
followed by a git merge
.
Doing git pull
for another branch is not possible, because doing git merge
for another branch is not possible. To be able to do git merge
, you need to checkout the target branch first. For this same reason, you cannot do git pull
for another branch.
@torek added an excellent point:
And, to specifically address git pull origin x:y: git pull passes the x:y argument to git fetch, so git fetch does what it does; but then git pull attempts to merge into the current branch, regardless of x and/or y.
See this also for reference: