[英]Git: Remove everything except for a certain directory (BFG Repo Cleaner)
I am trying to permanently remove all traces of all directories in a Git repository except for one directory, say named keep-me . 我试图永久删除Git存储库中所有目录的所有痕迹, 除了一个目录,比如名为keep-me 。
For such tasks, the BFG repo cleaner is my usual go-to tool. 对于这样的任务,BFG repo清洁器是我常用的工具。 However, it does not seem to support this operation (in fact, I believe it does not support extended globs).
但是,它似乎不支持此操作(事实上,我认为它不支持扩展的globs)。 I am really trying to accomplish the following, which does not get rid of the other directories:
我真的想要完成以下,没有摆脱其他目录:
java -jar ~/bfg-1.12.12.jar --delete-folders {!(keep-me)} my-repo.git
Thanks! 谢谢!
You can do it the other way round: 你可以反过来做:
git subtree split --prefix keep-me --branch cleaned-branch
This will create a new project history in the branch cleaned-branch
which only contains keep-me
. 这将在分支
cleaned-branch
创建一个新项目历史记录,其中只包含keep-me
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.