How to create reflogs information in an existing bare repository

对着背影说爱祢 提交于 2019-12-07 02:48:27

问题


As you might have known that by default, git doesn't enable reflog updates for new bare repositories. The problem is, I have a long history repository but it was created before I set the flag "logAllRefUpdates" on, and now I want that information for another application to work.

How can I achieve that with minimal changes made to the existing repository. A very simple solution is pushing a new commit which I don't want to (!) :-)


回答1:


The reflog is a relatively simple file format. Here's an example:

] cat .git/logs/HEAD|sed 's/\t/<TAB>/'
0000000000000000000000000000000000000000 5cfe4256d98af22a570c78c5e3048391a90f5f98 Joe User <foo@example.com> 1306427954 -0400<TAB>clone: from git://git.kernel.org/pub/scm/git/git.git

You can manually construct appropriate reflogs by following the same format:

previous-ref-or-zero new-ref User Name <user@email> unix-timestamp timezone\tmessage

Just create one of these for each ref. You can probably do this directly with git for-each-ref with an appropriate format string (thanks, Chris!)



来源:https://stackoverflow.com/questions/6140083/how-to-create-reflogs-information-in-an-existing-bare-repository

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