Pull A Git Branch from Remote

  • Pro Git book - free online book about git written by Scott Chacon and Ben Straub

Pull A Git Branch from Remote

Pull First!

Before trying to check out the branch your co-worker has asked you to look at run git pull.

git pull

This will make sure that when you checkout the branch if it is linked to the remote one.

Now you are ready to check out the branch

git checkout branch_name

You can now make your changes or look at the code

Didn't work

If you get the following error

error: pathspec 'branch_name' did not match any file(s) known to git.

Then you didn't pull, or you got the branch name wrong. git pull and try again or confirm the branch name.