简体   繁体   English

将 Git 存储库的一部分移动到另一个存储库以保留历史记录

[英]Moving part of Git repository to another repository preserving history

In this post I saw a method on how to clone an entire Git repository in a history preserving way.这篇文章中,我看到了一种关于如何以保留历史记录的方式克隆整个 Git 存储库的方法。 I am now trying to split two repositories into two pieces, so that one folder in my current repository should become its own independent repository.我现在试图将两个存储库分成两部分,以便我当前存储库中的一个文件夹成为它自己的独立存储库。 I would like to make it so that this folder was essentially cloned in a history preserving way, but such that only history concerning the files in that particular folder survives.我想这样做是为了使该文件夹基本上以保留历史记录的方式进行克隆,但是只有与该特定文件夹中的文件有关的历史记录才能保留下来。 Is that possible?那可能吗?

Clone the repo, then use the BFG repo cleaner to delete all the files in the other directory and all commits that are left empty because of that purge.克隆存储库,然后使用 BFG 存储库清理器删除另一个目录中的所有文件以及由于清除而留空的所有提交。

Then clone the original repo again and rinse and repeat for the other directory.然后再次克隆原始 repo 并冲洗并重复其他目录。

You can find the BFG repo cleaner here:您可以在此处找到 BFG 回购清理器:

. .

 git clone --mirror git://example.com/some-big-repo.git
 java -jar bfg.jar --delete-folders RemoveMe --delete-files RemoveMe
 cd some-big-repo.git $ git reflog expire --expire=now --all && git gc --prune=now --aggressive 

暂无
暂无

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

相关问题 将 Git 存储库内容移动到另一个存储库以保留历史记录 - Moving Git repository content to another repository preserving history 将git存储库历史记录的一部分移动到另一个存储库中 - Moving part of a git repository’s history into another repository 在移动GIT存储库时保留GIT提交的历史记录 - Preserving history of GIT commits while moving a GIT repository 将GIT存储库(和提交历史记录)移动到当前为空的另一个存储库 - Moving GIT repository (and commit history) to another repository currently empty 将目录移动到另一个git存储库,同时保留相关历史记录 - Moving a directory to another git repository while retaining relevant history 将带历史记录的git存储库导出到另一个存储 - Export git repository with history into another repository 从TFSVC迁移到GIT - 具有部分历史记录的存储库? - Moving from TFSVC to GIT - Repository with partial History? 将svn存储库迁移到另一个git存储库(作为其一部分) - Migrating svn repository to another git repository(as a part of it) 是否可以将一堆文件从一个git存储库移动到另一个git存储库,同时保留(大多数)历史记录? - Is it possible to move a bunch of files from one git repository to another while preserving (most) history? 如何将目录从一个git存储库复制到另一个目录,并保留历史记录? - How can I copy a directory from one git repository to another, preserving history?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM