简体   繁体   English

git reflog中的第二列是什么?

[英]What is the 2nd column in the git reflog?

I just did a simple git reflog and this is the first few lines I got: 我刚做了一个简单的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

I'm trying to understand what each column represents. 我试图了解每列代表什么。 Reading from this post and this question I've already learned: 这篇文章这个问题中读到我已经学到了:

  • Column1 is obviously the commit, Column1显然是提交,
  • Column2 is where I get confused. Column2是我感到困惑的地方。 I understand the HEAD@{0} to HEAD@{7} concept. 我理解HEAD@{0}HEAD@{7}概念。 Don't get the parts that are in the parenthesis! 不要得到括号内的零件! . What does (yy, alphabets, hotFix) represent? (yy, alphabets, hotFix)代表什么?
  • Column3 is the action ie checkout/pull along with a message. Column3是动作,即结帐/拉出以及消息。

Additionally I'm uncertain as to why there is multiple lines of the same commit? 另外我不确定为什么同一次提交有多行? Is it because different branches are all pointing to the same commit and there is no code changes between them? 是因为不同的分支都指向同一个提交,它们之间没有代码更改?

The reflog tells you how HEAD has moved. reflog告诉你HEAD是如何移动的。 There are more than three columns. 有三列以上。 The Git docs are obtuse about this. Git文档对此很迟钝。 It turns out git reflog is just an alias for git log with some switches. 事实证明, git reflog只是git log一个别名,带有一些开关。

git reflog show [the default] is an alias for git log -g --abbrev-commit --pretty=oneline; git reflog show [默认]是git log -g --abbrev-commit --pretty=oneline;的别名git log -g --abbrev-commit --pretty=oneline;

784f2cp3 (yy, alphabets, hotFix) HEAD@{7}: checkout: moving from alphabets to master
  1. 784f2cp3 The abbreviated commit. 784f2cp3缩写提交。
  2. (yy, alphabets, hotFix) The branch heads at this commit, just like git log --decorate . (yy, alphabets, hotFix)分支负责此提交,就像git log --decorate
  3. HEAD@{7} The location of this commit relative to HEAD , added by -g . HEAD@{7}此提交相对于HEAD的位置,由-g添加。
  4. checkout What command was run. checkout运行了什么命令。
  5. moving from alphabets to master A human readable description. moving from alphabets to master人类可读的描述。

(4 and 5 are technically the same column.) (4和5在技术上是相同的列。)

This says you were on branch alphabets and ran git checkout master . 这说你在分支alphabets运行git checkout master

Additionally I'm uncertain as to why there is multiple lines of the same commit? 另外我不确定为什么同一次提交有多行? Is it because different branches are all pointing to the same commit and there is no code changes between them? 是因为不同的分支都指向同一个提交,它们之间没有代码更改?

Yes, exactly. 对,就是这样。

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

yy , alphabets , hotFix , and master were all on the same commit. yyalphabetshotFixmaster都在同一个提交中。 Checking out between them simply changes which branch head will be moved the next commit. 在它们之间检查只是更改下一次提交将移动哪个分支头。

The others might be internal HEAD movements which happen when you run git pull . 其他可能是内部HEAD运动,当你运行git pull时会发生这种运动。 git pull is a combination of git fetch and git merge . git pullgit fetchgit merge的组合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM