git – pulling from specific branch

Total
0
Shares

I have cloned a git repository to my dev server and then switched to the dev branch but now I can’t do a git pull to update the branch.

How do I update the code on the server ?


Solution

See the git-pull man page:

git pull [options] [<repository> [<refspec>...]]

and in the examples section:

Merge into the current branch the remote branch next:

$ git pull origin next

So I imagine you want to do something like:

git pull origin dev

To set it up so that it does this by default while you’re on the dev branch:

git branch --set-upstream-to=origin/dev dev

Source: StackOverflow.com

Leave a Reply

Your email address will not be published. Required fields are marked *