[英]Move a git repository to another repository as a subfolder while keeping history
I have created and worked on a git repository github.com/softtimur/old
. 我已经创建并在git仓库
github.com/softtimur/old
。 I just created another git repository github.com/softtimur/Documents
, which has its own .../Documents/.git/
. 我刚刚创建了另一个git存储库
github.com/softtimur/Documents
,它具有自己的.../Documents/.git/
。 Now I want to create .../Documents/old
and move everything of github.com/softtimur/old
under it while keeping the commit history. 现在,我想创建
.../Documents/old
并将github.com/softtimur/old
所有内容github.com/softtimur/old
下,同时保留提交历史记录。 And then, I want to remove github.com/softtimur/old
. 然后,我要删除
github.com/softtimur/old
。
Does anyone know how to do this moving properly? 有人知道如何正确地进行此操作吗?
I would add another remote to your local checkout of github.com/softtimur/old
to allow you to to merge them and then push the result back 我会在您的
github.com/softtimur/old
本地结帐中添加另一个遥控器,以允许您合并它们,然后将结果推回
git clone git@github.com/softtimur/old.git
cd old
git remote add new git@github.com/softtimur/Documents.git
git fetch new
git checkout master
git merge new/master
git push -u new master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.