git pull on a different branch

I found an incantation that worked for me:

git fetch origin master:master

then (if you want to merge right away):

git merge master

I was really surprised how hard it was to find an answer to this since it seems like it would be a common use case.


Try this:

git pull yourRepositoryName master

We can fetch changes from another branch in the same repository using git pull command like this:

$ git pull origin <target-branch>

See the EXAMPLES section of man git-pull :

   •   Merge into the current branch the remote branch next:

           $ git pull origin next