如何分离Git中的子目录,但保留所有分支 [英] How to detach subdirectory in Git but keep all branches
问题描述
我一直在关注这个问题的答案将子目录分离为单独的Git存储库
a>,并且有一些很好的成功,只有一个分支上有简单的子目录,但现在我面临的是一个分散在多个分支上的子目录,所以一个简单的 git filter-branch --subdirectory-filter SUBDIRECTORY HEAD
不做
我是否必须切换到每个分支并运行filter-branch命令,或者是否有可以通过完整历史记录完成空白更改的内容?
命令末尾的 HEAD
处理。你可以给它任意数量的其他命令,包括 - all
来指定绝对的一切, - branches
指定只是分支,或 - 遥控器
来指定遥控器。您可能必须在 -
前加上这些选项以告诉filter-branch这些是rev-list参数。请注意, - all
会尝试显式处理标签,这可能不是您想要的。您可以使用 - branches --remotes
来指定所有非标记参考。您可能还想添加 - tag-name-filter cat
来重写指向重写提交的标记 - 原始命令将使这些标记保持不变。
I have been following the Answers to this question Detach subdirectory into separate Git repository and had some good successes with simple Subdirectories that are only on one branch but now I am confronted with a Subdirectory that is littered over multiple branches so a simple
git filter-branch --subdirectory-filter SUBDIRECTORY HEAD
does not do the job.
Do I have to switch into each and every branch and run the filter-branch command or is there something that can do a blanked change through the complete history ?
The HEAD
at the end of your command is specifying the ref to process. You can give it any number of other commands, including --all
to specify absolutely everything, --branches
to specify just branches, or --remotes
to specify just remotes. You may have to prefix these options with --
to tell filter-branch that these are rev-list args. Note that --all
will try to process tags explicitly, which may not be what you want. You could use --branches --remotes
to specify all non-tag refs instead. You may also want to add --tag-name-filter cat
to rewrite tags that point to rewritten commits - your original command will leave those tags unchanged.
这篇关于如何分离Git中的子目录,但保留所有分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!