BFG Repo-Cleaner在主分支上使用时,其他分支会发生什么情况?

huangapple go评论88阅读模式
英文:

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

问题

我正在尝试使用此工具来缩小我的.git文件夹的大小,目前为3.1GB。代码文件大小不到100MB。这个仓库很老,有大约250个分支。

如果我在主分支上使用这个工具,其他分支会发生什么情况?它提到:

> 默认情况下,BFG 不会修改您的主分支(或 'HEAD')上最新提交的内容,尽管它会清理它之前的所有提交。

所以我认为它会影响其他分支的内容吗?还是不会影响其他分支上的最新提交?我的目标是只要其他分支的最新提交是安全的,我就没问题。

英文:

I'm trying to use this tool to shrink my .git folder size which is 3.1GB right now. Code is under 100MB. This repo is very old and has many branches ~250.

If I use this tool on master branch, what will happen to other branches? 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.

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.

答案1

得分: 3

这正是新工具 git filter-repo 所做的,它代替了 BFG 和 git filter-branch,避免了完全重写到最新提交。

查看它的用户手册

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

它会在过滤后自动删除旧的无用数据并重新打包存储库,这样有助于用户简化操作,避免混淆新旧历史。

如下所示(仅应用于 master),这不会影响其他分支,但是新的 master 分支可能不再与其他分支共享任何公共历史。

英文:

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.
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); 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.

huangapple
  • 本文由 发表于 2020年1月3日 14:27:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/59574095.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定