DavidL
DavidL

Reputation: 915

git clone into a branch

Is it possible to clone a project into a new branch ? I have already cloned the main repo and would like to clone another repo that is a fork of it into a branch. I want to be able to keep comparing the differences using git diff. How can this be done ?

Upvotes: 9

Views: 2809

Answers (1)

knittl
knittl

Reputation: 265131

You can specify a new remote and then call git fetch:

git remote add fork git://example.com/repo.git
git fetch fork

You can then compare branches with

git diff origin/master fork/master

Upvotes: 12

Related Questions