[英]Move content from one git repository to another?
我在xp-dev.com上有一个当前的git仓库,我们称它为A。现在,我在xp-dev.com上创建了一个新项目,它有自己的git仓库,我们称它为B。现在,A有很多提交代码,我想将A的所有内容(包括提交历史记录)移到B。B是空的,它基本上只是一个初始化的存储库,没有检入代码。
我该怎么做呢? 我已经尝试自己解决它,但是似乎几乎不可能只说“将A的内容推入B” ...
拜托,帮帮我,昨晚我花了几个小时来做更多有生产力的事情:)
我是git的新手,我不了解xp-dev.com的详细信息,但是您应该可以使用类似的方法进行操作。
首先,克隆并镜像原始存储库
git clone --mirror orig-host:A
然后将其推送到新位置(前提是已创建回购协议)
cd A
git push --mirror new-host:B
注意:这对新存储库具有破坏性。 可能值得先离线进行尝试。
请尝试以下顺序:
git clone orig-host:repo
cd repo
git remote add target dest-host:repo
git push target master
# repeat the last command for every unmerged branch
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.