How do you fork a repo whose upstream you've already forked?

假如想象 提交于 2020-01-03 08:17:08

问题


I want to fork namecoin/namecoin, but I've already forked bitcoin/bitcoin. The latter is the upstream parent of the former. The forkchain is:

bitcoin/bitcoin -> vinced/namecoin -> namecoin/namecoin

When I fork namecoin/namecoin, Github just redirects me to my myuserid/bitcoin fork, instead of creating a new myuserid/namecoin fork. It appears to Github that they are the same project, but they are not.

Anyone know how to do this?


回答1:


You can't do this "officially", but you can always add another remote for bitcoin and fetch from that.

git remote add bitcoin-orig git://the/bitcoin/repo/path

git fetch bitcoin-orig

# Merge into your 'master' (CAUTION: This might go badly)
git merge bitcoin-orig/master  

# Create a local branch based on the origin
git co -b bitcoin-orig-master bitcoin-orig/master  

# Take an individual commit from the original repo and put it into your 'master'
git log bitcoin-orig/master && git cherry-pick <SOME SHA>  


来源:https://stackoverflow.com/questions/8290678/how-do-you-fork-a-repo-whose-upstream-youve-already-forked

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!