【问题标题】:What is the 2nd column in the git reflog?git reflog 中的第二列是什么?
【发布时间】:2018-07-15 18:15:15
【问题描述】:

我刚刚做了一个简单的git reflog,这是我得到的前几行:

column1                 Column2                                Column3
2797a1d4 (HEAD -> master, upstream/master) HEAD@{0}: checkout: moving from master to master
2797a1d4 (HEAD -> master, upstream/master) HEAD@{1}: pull upstream master: Fast-forward
a461a29f HEAD@{2}: checkout: moving from master to master
a461a29f HEAD@{3}: reset: moving to HEAD
a461a29f HEAD@{4}: pull upstream master: Fast-forward
784f2cp3 (yy, alphabets, hotFix) HEAD@{5}: checkout: moving from yy to master
784f2cp3 (yy, alphabets, hotFix) HEAD@{6}: checkout: moving from master to yy
784f2cp3 (yy, alphabets, hotFix) HEAD@{7}: checkout: moving from alphabets to master

我试图了解每列代表什么。从this postthis question 阅读我已经学会了:

  • Column1 显然是提交,
  • Column2 是我感到困惑的地方。我理解HEAD@{0}HEAD@{7} 的概念。 不要得到括号中的部分!(yy, alphabets, hotFix) 代表什么?
  • Column3 是操作,即结帐/拉取消息。

此外,我不确定为什么会有多行相同的提交?是不是因为不同的分支都指向同一个commit,它们之间没有代码变化?

【问题讨论】:

  • 我也读过git-reflog's documentation,但据我所知,它要么没有被提及,要么我不擅长阅读它的手册。我只是希望有一些文档可以告诉您是否执行此命令,然后这些是列标签。我在帮助页面中看到的只是每个命令 options

标签: git git-reflog


【解决方案1】:

reflog 告诉你HEAD 是如何移动的。有超过三列。 Git 文档对此很迟钝。原来git reflog 只是git log 的别名,带有一些开关。

git reflog show [默认] 是git log -g --abbrev-commit --pretty=oneline; 的别名

784f2cp3 (yy, alphabets, hotFix) HEAD@{7}: checkout: moving from alphabets to master
  1. 784f2cp3 提交的缩写。
  2. (yy, alphabets, hotFix) 在这次提交中的分支负责人,就像 git log --decorate
  3. HEAD@{7} 此提交相对于HEAD 的位置,由-g 添加。
  4. checkout 运行了什么命令。
  5. moving from alphabets to master 人类可读的描述。

(4 和 5 在技术上是同一列。)

这表示您在分支 alphabets 并运行 git checkout master

此外,我不确定为什么会有多行相同的提交?是不是因为不同的分支都指向同一个commit,它们之间没有代码变化?

是的,没错。

784f2cp3 (yy, alphabets, hotFix) HEAD@{5}: checkout: moving from yy to master
784f2cp3 (yy, alphabets, hotFix) HEAD@{6}: checkout: moving from master to yy
784f2cp3 (yy, alphabets, hotFix) HEAD@{7}: checkout: moving from alphabets to master

yyalphabetshotFixmaster 都在同一个提交上。在它们之间签出只是更改了下一次提交将移动哪个分支头。

其他可能是内部HEAD 运动,当您运行git pull 时发生。 git pullgit fetchgit merge 的组合。

【讨论】:

  • 谢谢。 HEAD -> master 在这里是什么意思?
  • @Honey 表示master 当前已签出,HEAD 指向master
  • 我刚刚又做了一个git reflog,得到了:(HEAD -> develop, origin/develop, origin/HEAD)origin/HEAD 在这里是什么意思?其他两个我了解...
  • @Honey 这是HEAD 在名为origin 的远程存储库上的位置。请参阅this answer 了解更多信息。
猜你喜欢
  • 1970-01-01
  • 2013-07-25
  • 2020-08-16
  • 1970-01-01
  • 2017-02-04
  • 2018-02-08
  • 1970-01-01
  • 2012-04-24
  • 1970-01-01
相关资源
最近更新 更多