Question

How does one add a local branch from that of another developer? My colleague's branch is not out on origin.

Thanks!

Was it helpful?

Solution

First, add a "remote" (like a nickname for a repository URL) for your colleague's repository:

git remote add colleague <URL-of-their-repository>

Then fetch all the branches from that repository into remote tracking branches called refs/remotes/colleague/<branch-name> (which can usually be abbreviated to colleague/<branch-name>):

git fetch colleague

Now create (and switch to) a local branch called foo which tracks your colleague's branch called foo with:

git checkout --track colleague/foo
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top