Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top