2

I typed the following expressions into the command line:

 git remote add coworkerBranch git://coworkersUsername/repo.git
 git fetch origin
 git checkout coworkerBranch

However, when I checked the files on my local drive, they weren't altered to match my coworker's changes. I'm new to this whole git syntax so I may be completely off, but is there anything else I need to do to access his files?

Nick Boukis
  • 55
  • 1
  • 4

1 Answers1

5

You don't checkout a remote (see "Working with remotes"): you fetch from it, and checkout one of its branch:

git remote add coworker git://coworkersUsername/repo.git
git fetch coworker 
git branch --all # choose a branch
git checkout --track -b aBranch coworker/aBranch

(See "Working with remote branches")

"coworker" is the name for a reference to a coworker repo, which is different than "origin".
"origin" references the original repo you cloned.
But you can add as many other upstream repos you want/need.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250