简体   繁体   English

Git reflog到期时间

[英]Git reflog expiration time

I have known that reflog entries gets deleted which are older than 90 days . 我知道删除了超过90天的 reflog条目。 I have not made any change in git config too regarding this. 我没有对git配置做任何改变。 Today when I did git reflog master --date=local , I can see entries of 10 months before in it. 今天当我做git reflog master --date=local ,我可以看到10个月前的条目。 How is that possible ?I should only be seeing entries dating back to 3 months before only ? 这怎么可能?我应该只看到可追溯到3个月前的参赛作品?

Git will automatically run git gc periodically, provided you don't disable it. 如果你git gc用它,Git会定期自动运行git gc But the period for this automatic GC is not defined anywhere, and in fact, it's not based on time at all. 但是这个自动GC的时间段并没有在任何地方定义,事实上,它根本不是基于时间的。 Instead, it's based on a quick survey that git gc --auto makes of the state of the repository. 相反,它基于git gc --auto对存储库状态的快速调查。 Moreover, it's actually kicked off by running some other Git command, which simply runs git gc --auto at the end of its work. 此外,它实际上是通过运行其他Git命令开始的,它只是在工作结束时运行git gc --auto That git gc --auto then decides whether to run git gc , and if so, that git gc runs git reflog expire with the 90 day expiration. 那个git gc --auto然后决定是否运行git gc ,如果是的话, git gc运行git reflog expire 90天。

In this case, perhaps either you have not run a Git command that ran git gc --auto , or git gc --auto chose not to do anything, for 10 months. 在这种情况下,也许你没有运行git命令运行git gc --auto ,或者git gc --auto选择不执行任何操作,持续10个月。 That seems a bit excessive, 1 so it's more likely you disabled automatic GC by setting gc.auto to 0 . 这似乎有点过分, 1所以你更有可能通过将gc.auto设置为0来禁用自动GC。 It's also possible you have hit an interesting bug: see this answer by VonC to one of the "see also" questions below, which has a fix for a bug that did bite people. 你也可能遇到了一个有趣的错误:看看VonC对下面的“另见”问题的回答,这个问题解决了一个让人咬人的错误。

See also List of all commands that cause git gc --auto , Understanding git gc --auto , and How often should you use git-gc? 另请参阅导致git gc --auto的所有命令的列表了解git gc --auto ,以及您应该多久使用一次git-gc?


1 How excessive this is depends on how active the repository is. 1这有多大取决于存储库的活动程度。 A fairly quiet repo might not accumulate enough loose objects to make git gc --auto do anything for many months; 一个相当安静的回购可能不会累积足够的松散物体来制作git gc --auto做了好几个月的事情; a busy one will need automatic gc pretty frequently. 一个忙碌的人会经常需要自动gc。

How is that possible? 怎么可能?

Pretty simple explanation - that is possible if you don't run git reflog expire or git gc regularly. 非常简单的解释 - 如果你不经常运行git reflog expiregit gc ,这是可能的。 If you did that and they are still there, please amend your question. 如果您这样做并且他们仍在那里,请修改您的问题。 Else, that's it. 不,就是这样。

Type git gc and see them disappear. 输入git gc并看到它们消失。

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

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