有人可以帮我理解这里发生了什么吗?
我开始git log --oneline,吐出来:
4df9421 (HEAD, master) moved some aliases around
d3810e4 (origin/master) some terminal color changes
a7182d3 git colors, ignores, etc.
995fe8c added gitconfig, moved some personal stuff out of the public repo
8a100b7 misc unimportant updates
55d2c08 added a fix to "open with", refactored
7ec7d83 Removed some vim colors; added a couple searching aliases
330c7fc Minor updates
44e80a1 Added vim files
48537c6 Fixed some formatting problems
14933a2 Initial Commit
Run Code Online (Sandbox Code Playgroud)
然后我做git reset --hard 330c7fc了将日志带回:
330c7fc (HEAD, master) Minor updates
44e80a1 Added vim files
48537c6 Fixed some formatting problems
14933a2 Initial Commit
Run Code Online (Sandbox Code Playgroud)
到目前为止这么好,但是(现在我已经重置)当我这样做时git log --oneline --all:
d3810e4 (origin/master) some terminal color changes
a7182d3 git colors, ignores, etc.
995fe8c added gitconfig, moved some personal stuff out of the public repo
8a100b7 misc unimportant updates
55d2c08 added a fix to "open with", refactored
7ec7d83 Removed some vim colors; added a couple searching aliases
330c7fc (HEAD, master) Minor updates
44e80a1 Added vim files
48537c6 Fixed some formatting problems
14933a2 Initial Commit
Run Code Online (Sandbox Code Playgroud)
请注意,此列表中缺少最近的条目"4df9421移动了一些别名".
我的理解是该--all选项应显示所有提交.一旦我恢复到之前的提交,为什么最新的丢失?
谢谢.
它缺失了,因为HEAD或分支不再引用它.
您已将(HEAD和master)重置为另一个提交,并使用您的git reset --hard.
只会git reflog告诉你最近的提交.
git log --all仅用于列出引用的提交refs/(如标签,磁头,......)
--all
Run Code Online (Sandbox Code Playgroud)
假设所有引用
refs/都在命令行中列出为<commit>.