Git fetch remote branch
Asked 07 September, 2021
Viewed 2.7K times
  • 67
Votes

My colleague and I are working on the same repository. We've branched it into two branches, each technically for different projects, but they have similarities, so we'll sometimes want to commit back to the *master from the branch.

However, I have the branch. How can my colleague pull that branch specifically?

A git clone of the repository does not seem to create the branches locally for him, though I can see them live on unfuddle after a push on my end.

Also, when I originally made the branch, I did -b checkout. Does that make much difference?

$ git branch -r
origin/HEAD -> origin/master
origin/daves_branch
origin/discover
origin/master

$ git fetch origin discover
$ git checkout discover

These are the commands I ran. But it definitely is not working.

I want to be able to check out that branch and then push and commit back just the branches changes from various collaborators or workstations.

30 Answer