你应该多久使用一次git-gc? [英] How often should you use git-gc?

查看:122
本文介绍了你应该多久使用一次git-gc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你应该多久使用一次git-gc?

手册页简单地说:


鼓励用户定期在每个存储库中运行此任务以维护好的磁盘空间利用率和良好的操作性能。


是否有一些命令可以获得一些对象数量来确定是否应该使用gc?

解决方案

这主要取决于存储库的使用量。一个用户每天检查一次,一个分支/合并/等操作每周一次,你可能不需要每年运行一次以上。



用几十名开发人员在数十个项目中工作,每天检查2-3次,您可能想每晚检查一次。



运行它不会有什么坏处但我经常需要它。



我现在要做的就是运行它,然后在一周后测量磁盘利用率,再次运行它,然后测量磁盘再次利用。如果它下降5%,那么每周运行一次。如果它下降更多,则更频繁地运行它。如果它减少,那么运行次数会减少。


How often should you use git-gc?

The manual page simply says:

Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance.

Are there some commands to get some object counts to find out whether it's time to gc?

解决方案

It depends mostly on how much the repository is used. With one user checking in once a day and a branch/merge/etc operation once a week you probably don't need to run it more than once a year.

With several dozen developers working on several dozen projects each checking in 2-3 times a day, you might want to run it nightly.

It won't hurt to run it more frequently than needed, though.

What I'd do is run it now, then a week from now take a measurement of disk utilization, run it again, and measure disk utilization again. If it drops 5% in size, then run it once a week. If it drops more, then run it more frequently. If it drops less, then run it less frequently.

这篇关于你应该多久使用一次git-gc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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