1

我已经使用 镜像了一个 git 存储库git clone --mirror,然后设置git config core.logAllRefUpdates true,然后使用git fetch -p.

在托管 repo 的服务器上,如果我git reflogrepository.git目录中运行,我不会得到任何输出。

core.logAllRefUpdatesrefs 所在状态的文档$GIT_DIR/logs/<ref>,但我没有日志目录。我需要手动创建吗?

core.logAllRefUpdates

启用 reflog。通过附加新旧 SHA-1、日期/时间和更新原因,将对 ref 的更新记录到文件“$GIT_DIR/logs/”中,但仅当文件存在时。如果此配置变量设置为 true,则会自动为分支头(即 refs/heads/ 下)、远程 refs(即 refs/remotes/ 下)、注释 refs(即 refs 下)创建缺少的“$GIT_DIR/logs/”文件/notes/) 和符号 ref HEAD。如果它设置为 always,那么会自动为 refs/ 下的任何 ref 创建一个缺失的 reflog。

4

1 回答 1

3

不,您不必创建该目录。对于裸存储库,只需通过以下方式启用 reflogs

git config core.logAllRefUpdates true

truealways受支持。然后查看分支类型的 reflog

git reflog <branch>

在此处查看更多详细信息,以及其他配置选项的文档页面。git reflog

于 2018-03-12T15:29:43.310 回答