【发布时间】:2018-09-24 15:36:29
【问题描述】:
我想将一个文件夹从 git 移动到另一个 git 存储库。
例如:
这是我在 Git 中当前的文件夹结构。
src/Project/RegistrationBundle
src/Project/PictureGenerationBundle
src/Project/CloudDriveBundle
readme.md
我想将它移动到具有以下文件夹结构的新存储库,但我想保留以前存储库中的 git 历史记录:
src/RegistrationBundle
readme.md
我尝试用 git filter-branch 运行它
git filter-branch --subdirectory-filter src/Project/RegistrationBundle/
但是,我找不到自定义文件夹结构的解决方案。
如果可以,请告诉我。
非常感谢。
【问题讨论】:
-
您希望文件夹“src/RegistrationBundle”保留为旧仓库的一部分吗?如果是,您是否希望 src/RegistrationBundle 的任何文件中的单个更改都反映在两个 repos 上?
-
我对你的问题没有完整的答案,但还值得一提的是,将存储库移到一边,git 是not great at tracking file renames and directory structure changes within a repo。如果您首先在 Repo A 中将目录结构更改作为其自己的提交提交,然后使用 filter-branch 迁移到 Repo B,您可能会有一些运气。
标签: git github gitlab bitbucket