reflog

作者: 一江碎月 | 来源:发表于2018-03-18 21:36 被阅读0次

作用

引用日志

在工作时, Git 会在后台保存一个引用日志(reflog),引用日志记录了最近几个月你的 HEAD 和分支引用所指向的历史

  1. 每当 HEAD 所指向的位置发生了变化,Git 就会将这个信息存储到引用日志这个历史记录里。例如:切换分支、新建提交、使用 reset 回退 时会在 reflog 中进行记录。

  2. 使用 @{n} 指定查看仓库中 HEAD 在 n 次前的所指向的提交

  3. 引用日志只存储于本地,与其他人、远程仓库都无关。

$     git reflog
9b3a660 HEAD@{0}: commit: third
dc214b5 HEAD@{1}: checkout: moving from dev to master
dc214b5 HEAD@{2}: checkout: moving from master to dev
dc214b5 HEAD@{3}: commit: second
9b335a3 HEAD@{4}: commit (initial): first

$     git reflog HEAD@{1}
dc214b5 HEAD@{1}: checkout: moving from dev to master
dc214b5 HEAD@{2}: checkout: moving from master to dev
dc214b5 HEAD@{3}: commit: second
9b335a3 HEAD@{4}: commit (initial): first

使用 @{1} 时,除了最新的一条没有输出。因为 @{1} 查询的是最新 1 次前的所有 HEAD 变化记录。

相关文章

  • reflog

    作用 引用日志 在工作时, Git 会在后台保存一个引用日志(reflog),引用日志记录了最近几个月你的 HEA...

  • git常用命令

    git log git reflog git reset git log git reflog git check...

  • git reflog

    前言 之前开发的时候遇到过一次电脑异常重启的状况,电脑重启后再次进入Android Studio, 发现代码不在原...

  • git教程

    git教程 git reflog git reflog 可以查看所有分支的所有操作记录(包括(包括commit和r...

  • Git 更改已提交的操作

    git reflog 查看当前仓库的所有操作日志 reflog git log 命令只能查看以当前状态为终点的历史...

  • git log和git reflog的区别

    git log和git reflog的区别 git reflog命令可以查看所有分支的所有操作记录信息(包括已经被...

  • iOS Git

    Git$ git reflog : Git提供了一个命令git reflog用来记录你的每一次命令:$ git r...

  • git commit历史里消失的记录怎么看

    或者自己本地如果对应的目录还在的话,可以用git reflog命令 利用git reflog找回错误的重置[htt...

  • log 和 reflog

    git log是查看commit的历史记录。 git reflog是查看所有git操作的历史记录。

  • GIT-Reflog

    1、git reflog : 查看操作记录 2、撤销某次记录 git reset --soft HEAD@{1} ...

网友评论

      本文标题:reflog

      本文链接:https://www.haomeiwen.com/subject/czyyqftx.html