git - pulling from specific branch
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
if you want to pull from a specific branch all you have to do is
git pull 'remote_name' 'branch_name'
NOTE: Make sure you commit your code first.
Here is what you need to do. First make sure you are in branch that you don't want to pull. For example if you have master and develop branch, and you are trying to pull develop branch then stay in master branch.
git checkout master
Then,
git pull origin develop
It's often clearer to separate the two actions git pull
does. The first thing it does is update the local tracking branc that corresponds to the remote branch. This can be done with git fetch
. The second is that it then merges in changes, which can of course be done with git merge
, though other options such as git rebase
are occasionally useful.