我已经使用 git clone --mirror
镜像了一个 git 仓库, 然后设置 git config core.logAllRefUpdates true
,然后更新为 git fetch -p
.
在托管存储库的服务器上,如果我运行 git reflog
在repository.git
目录,我没有输出。
core.logAllRefUpdates
的文档指出 refs 被放置在 $GIT_DIR/logs/<ref>
中,但我没有日志目录。我需要手动创建吗?
core.logAllRefUpdates
Enable the reflog. Updates to a ref is logged to the file "$GIT_DIR/logs/", by appending the new and old SHA-1, the date/time and the reason of the update, but only when the file exists. If this configuration variable is set to true, missing "$GIT_DIR/logs/" file is automatically created for branch heads (i.e. under refs/heads/), remote refs (i.e. under refs/remotes/), note refs (i.e. under refs/notes/), and the symbolic ref HEAD. If it is set to always, then a missing reflog is automatically created for any ref under refs/.
最佳答案
不,您不必创建该目录。对于裸存储库,只需通过
启用 reflogsgit config core.logAllRefUpdates true
支持值true
和always
。然后查看分支类型的reflog
git reflog <branch>
查看更多详情 here , 和 documentation page of git reflog
, 对于其他配置选项。
关于将 core.logAllRefUpdates 设置为 true 的裸存储库中的 git reflog 不返回任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48769443/