如何在保留提交的同时将项目从我的个人存储库迁移到组织存储库

时间:2018-10-28 17:10:52

标签: git github

我的个人github中有一个存储库,需要将其移至组织的存储库。我想在提交到组织中的新仓库时保留提交。我该怎么做?

1 个答案:

答案 0 :(得分:0)

在组织中创建一个空的存储库,然后将其克隆。

在此仓库中,将您的github存储库添加为nex远程服务器:

 git remote add githubrepo https://somewhere.on.github/project

然后抓取

 git fetch githubrepo

然后将github母版推送到您的组织母版(假定位于源远程)

 git push -f origin githubrepo/master:master # you probably need to force as you rewrite the history somehow

这是供master使用的,然后您可以将所需的任何分支推送到原始仓库