繁体   English   中英

如何将代码从其他 github 存储库(不是 fork)拉到我的 github 存储库?

[英]How to pull code from other github repository (not fork) to my github repository?

我有两个 github 存储库,我想通过保存提交历史将代码从一个存储库拉到另一个存储库。 我怎样才能做到这一点? 不幸的是,第二个不是第一个的分支。

我不相信有办法从一个 GitHub 回购直接拉到另一个,但你完全可以手动完成。

首先,从您的第一个回购中提取:

git pull

其次,将第二个 repo 添加为新源:

git remote add origin2 <new_repo_url>

最后,推送到第二个仓库( origin2 ,即):

git push -u origin2 <branch_name>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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