简体   繁体   English

当我在 master 上使用 BFG Repo-Cleaner 时,其他分支会发生什么

[英]What happens to other branches when I use BFG Repo-Cleaner on master

I'm trying to use this tool to shrink my .git folder size which is 3.1GB right now.我正在尝试使用这个工具来缩小我的.git文件夹大小,现在是 3.1GB。 Code is under 100MB.代码小于 100MB。 This repo is very old and has many branches ~250.这个 repo 很老了,有很多分支~250。

If I use this tool on master branch, what will happen to other branches?如果我在 master 分支上使用这个工具,其他分支会发生什么? It mentions:它提到:

By default the BFG doesn't modify the contents of your latest commit on your master (or 'HEAD') branch, even though it will clean all the commits before it.默认情况下,BFG 不会修改您在 master(或“HEAD”)分支上的最新提交的内容,即使它会清除它之前的所有提交。

So I assume it would break up things in other branches?所以我认为它会破坏其他分支的东西? Or it doesn't break latest commits on other branches?或者它不会破坏其他分支上的最新提交? What I want to achieve is as long as other branches' latest commit is safe, I'm fine.我想要实现的是只要其他分支的最新提交是安全的,我就可以了。

That is precisely what the new tool git filter-repo , which replaces BFG and git filter-branch , avoids: it does rewrite all the way to the latest commit.这正是取代 BFG 和git filter-branch的新工具git filter-repo避免的:它确实一直重写到最新提交。
See its user manual请参阅其用户手册

git filter-repo --strip-blobs-bigger-than 10M --refs master

It automatically removes old cruft and repacks the repository for the user after filtering (unless overridden);它会自动删除旧的 cruft 并在过滤后为用户重新打包存储库(除非被覆盖); this simplifies things for the user, helps avoid mixing old and new history together.这为用户简化了事情,有助于避免将新旧历史混合在一起。

As show here (applied only on master ), that won't touch the other branches, but yes, the new master branch might no longer share any common history with other branches.如此处所示(仅适用于master ),这不会触及其他分支,但是是的,新的master分支可能不再与其他分支共享任何共同的历史记录。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM