Imagine, I have several branches: master, a, b, c …
Now I’m in master branch and “git pull”. This fetches all changes from remote server into origin/master, origin/a, origin/b … branches and merges CURRENT branch (master) with origin/master. But then I want to switch to A branch and again merge these remote changes from remote tracked branch, WITHOUT fetching changes again (as they already are in origin/a branch).
Is there some simplier way to do this not specifying exactly remote branch I track (i.e. automatically) ?
I don’t believe there’s a built-in command for this. However, you could do something like this:
I think I’ve covered my bases pretty well – it exits with failure status if in detached HEAD state, or if the current branch doesn’t have a tracking branch. It defaults the to origin, as do the normal git transfer commands. (Something weird will happen if you try to use it on a branch which is tracking something other than a branch on the remote, i.e. not of the form refs/heads/*, but that seems pretty unlikely.) Doesn’t seem like it’d actually save you much time, but there you are!
If you want to use it, just store it somewhere and alias to it, or name it git-something and put it in your PATH.