Pull A Git Branch from Remote
Up until lately I have been improperly pulling my remote branches to local. What I mean is I create a new branch locally, push it to remote (GitHub) then pull it onto a designers computer with the following command
(this is not how to do it)
#DON’T DO THIS
git checkout -b < new_branch >
git pull origin < new_branch >
git checkout -b < new_branch >
git pull origin < new_branch >
Instead do
git checkout -b < new_branch > origin/< new_branch >
So real world example would be
git checkout -b newdesign origin/newdesign
Obviously ‘newdesign’ is the branch name.
UPDATE:
If you have trouble doing this with an error
fatal: git checkout: updating paths is incompatible with switching branches/forcing
Did you intend to checkout ‘origin/‘ which can not be resolved as commit?’
Did you intend to checkout ‘origin/
Then try a git pull first.
git pull
Related Posts
Posted on July 22, 2009 at 1:56 pm by Jordan Carter · Permalink
In: Uncategorized · Tagged with: checkout, git, Pull, Remote Branch
In: Uncategorized · Tagged with: checkout, git, Pull, Remote Branch


on July 28, 2009 at 2:13 am
Permalink
I don’t understand why the latter is preferred. They appear to do the same thing.
on March 29, 2010 at 1:24 pm
Permalink
Thanks,
This help me