Keep Git Reflog Indefinitely?

痴心易碎 提交于 2020-06-25 07:40:20

问题


I tend to be a bit paranoid about my data, including the ability to recover it.

Git reflog data is pruned after 30 days. Is there a way of setting it so that the reflog data is maintained and kept indefinitely?

Any major advantage or disadvantage (other than space or speed considerations) to doing so?


回答1:


Caveat: reflogs are local and are not sent/received with push/pull operations.

Cons: reflogs may result in (otherwise) unreachable snapshots (and consequently blobs) being kept around, growing your repo to larger sizes than might be desirable. Look at gc.reflogexpireunreachable for something that may help in this respect.

Two configuration settings govern the expiration of reflog entries:

gc.reflogexpire, gc.<pattern>.reflogexpire

git reflog expire removes reflog entries older than this time; defaults to 90 days. With "<pattern>" (e.g. "refs/stash") in the middle the setting applies only to the refs that match the .

gc.reflogexpireunreachable, gc.<ref>.reflogexpireunreachable

git reflog expire removes reflog entries older than this time and are not reachable from the current tip; defaults to 30 days. With "<pattern>" (e.g. "refs/stash") in the middle, the setting applies only to the refs that match the <pattern>.



来源:https://stackoverflow.com/questions/10422768/keep-git-reflog-indefinitely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!