简体   繁体   English

将git存储库作为子文件夹移动到另一个存储库,同时保留历史记录

[英]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.

相关问题 git 将目录移动到另一个存储库,同时保留历史记录 - git move directory to another repository while keeping the history Git:将存储库移动到另一个存储库的子文件夹 - Git: move repository to a subfolder of another repository 将文件夹移动到另一个git存储库并保留历史记录 - Move folder to another git repository and keep the history 将文件移动到另一个具有历史记录的 Git 存储库 - Move file to another Git repository with history Git:如何在不丢失历史记录的情况下将存储库移动到另一个存储库? - Git: How to move repository in another repository without losing the history? 将git存储库发布到另一个git存储库的子文件夹 - Publish a git repository to a subfolder of another git repository 将Git存储库合并到另一个保留所有历史记录的存储库中 - Merge a Git repository into another one keeping all the history 是否可以将一堆文件从一个git存储库移动到另一个git存储库,同时保留(大多数)历史记录? - Is it possible to move a bunch of files from one git repository to another while preserving (most) history? 如何在保留历史记录的同时将文件从一个git存储库移动到另一个存储库 - How to move a file from one git repository to another while preserving history 将带历史记录的git存储库导出到另一个存储 - Export git repository with history into another repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM