我怎样才能在Git远程仓库上触发垃圾收集? [英] How can I trigger garbage collection on a Git remote repository?

查看:106
本文介绍了我怎样才能在Git远程仓库上触发垃圾收集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我们所知,我们可以定期运行 git gc 来打包<​​code> .git / objects 下的对象。 myproj.git / objects / code>;每个提交似乎都会在那里创建一个新文件。



如何打包许多文件? (我的意思是在远程中央裸仓库上,而不是在本地克隆仓库上)。在提交完成后根据需要运行gc。在git-gc和git-config的手册页中查看gc.auto的文档。

然而,远程仓库不需要太多的垃圾收集,因为它很少会有悬而未决(无法访问)的提交。这些通常是由于分支删除和重新分配等原因造成的,这通常只发生在本地回购中。



因此,重新包装需要更多gc,这是为了节省存储空间,而不是去除实际的垃圾。 gc.auto变量足以应付此问题。


As we know, we can periodically run git gc to pack objects under .git/objects.

In the case of a remote central Git repository (bare or not), though, after many pushes, there many files under myproj.git/objects; each commit seems to create a new file there.

How can I pack that many files? (I mean the ones on the remote central bare repository, not on local clone repository.)

解决方案

The remote repo should be configured to run gc as needed after a commit is made. See the documentation of gc.auto in git-gc and git-config man pages.

However, a remote repo shouldn't need all that much garbage collection, since it will rarely have dangling (unreachable) commits. These usually result from things like branch deletion and rebasing, which typically happen only in local repos.

So gc is needed more for repacking, which is for saving storage space rather than removing actual garbage. The gc.auto variable is sufficient for taking care of this.

这篇关于我怎样才能在Git远程仓库上触发垃圾收集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆