git reflog命令

git reflog命令教程

git reflog 命令可以查看所有分支的所有操作记录(包括 commit 和 reset 的操作),同时也包括已经被删除的 commit 记录。

git reflog命令详解

语法

git reflog <subcommand> <options>

参数

参数 描述
subcommand git reflog 命令使用的子命令。
options git reflog 命令使用的选项。

显示提交reflog

语法

git reflog commitId

案例

我们使用 git reflog 命令,查看提交的 reflog,具体命令如下:

git reflog HEAD

执行完毕后,如下图所示:

07_git reflog命令详解.png

我们看到,我们使用了 git reflog 命令显示了 HEAD 的所有提交记录。

git reflog命令详解总结

git reflog 命令可以查看所有分支的所有操作记录(包括 commit 和 reset 的操作),同时也包括已经被删除的 commit 记录。