我做了一个简单的事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
Run Code Online (Sandbox Code Playgroud)
我试图了解每列代表什么.从这篇文章和这个问题中读到我已经学到了:
HEAD@{0}到HEAD@{7}的概念.不要得到括号内的零件!.什么是(yy, alphabets, hotFix)代表?另外我不确定为什么同一次提交有多行?是因为不同的分支都指向同一个提交,它们之间没有代码更改?
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
Run Code Online (Sandbox Code Playgroud)
784f2cp3 缩写提交.(yy, alphabets, hotFix)分支机构负责此提交,就像git log --decorate.HEAD@{7}此提交的位置相对于HEAD,添加-g.checkout 运行了什么命令.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
Run Code Online (Sandbox Code Playgroud)
yy,alphabets,hotFix,并且master都在同犯.在它们之间检查只是更改下一次提交将移动哪个分支头.
其他可能是HEAD你跑步时发生的内部动作git pull.git pull是的组合git fetch和git merge.