简体   繁体   中英

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM