簡體   English   中英

git reflog中的第二列是什么?

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

我剛做了一個簡單的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

我試圖了解每列代表什么。 這篇文章這個問題中讀到我已經學到了:

  • Column1顯然是提交,
  • Column2是我感到困惑的地方。 我理解HEAD@{0}HEAD@{7}概念。 不要得到括號內的零件! (yy, alphabets, hotFix)代表什么?
  • Column3是動作,即結帳/拉出以及消息。

另外我不確定為什么同一次提交有多行? 是因為不同的分支都指向同一個提交,它們之間沒有代碼更改?

reflog告訴你HEAD是如何移動的。 有三列以上。 Git文檔對此很遲鈍。 事實證明, git reflog只是git log一個別名,帶有一些開關。

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縮寫提交。
  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

另外我不確定為什么同一次提交有多行? 是因為不同的分支都指向同一個提交,它們之間沒有代碼更改?

對,就是這樣。

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的組合。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM