Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I checkout with Git a branch on a Fork of my Origin?

There is a repository /abc on GitHub that I forked. So my fork is at me/abc.

Jim also forked /abc, with their repo at Jim/abc. Jim added a branch called 2.0. This branch doesn't exist on /abc.

I have already cloned by fork from me/abc locally (used GitHub for Window). I would now like to make some modifications to the 2.0 branch from Jim/abc locally, and them commit and push the changes back.

What is the best way to go about doing this?

like image 724
Yaakov Ellis Avatar asked Jun 19 '13 11:06

Yaakov Ellis


1 Answers

I was able to accomplish this by doing the following:

1. Add Remote pointing to Jim/abc:

git remote add jim https://github.com/jim/abc.git

2. Fetch the repository Jim:

git fetch jim

3. Checkout the branch from the Jim/abc remote:

git checkout jim/2.0

Branch is now in "detached HEAD" state.

4. Create local branch:

git checkout -b 2.0

Branch is now checked out and ready for work locally.

like image 153
Yaakov Ellis Avatar answered Sep 30 '22 17:09

Yaakov Ellis