git --all丢失提交 [英] git --all missing commit

查看:98
本文介绍了git --all丢失提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我从> git log --oneline 开始,它会吐出:

  4df9421(HEAD,master)在
d3810e4(origin / master)的某个终端附近移动了一些别名颜色变化
a7182d3 git颜色,忽略等
995fe8c添加gitconfig,将某些个人内容移出公共回购
8a100b7其他不重要更新
55d2c08添加了一个修复程序open与,重构
7ec7d83删除了一些vim颜色;添加了一对夫妇搜索别名
330c7fc次要更新
44e80a1添加了vim文件
48537c6修复了一些格式问题
14933a2初始提交

然后我做 git reset --hard 330c7fc ,它会将日志恢复为:

  330c7fc(HEAD,master)次要更新
44e80a1添加了vim文件
48537c6修复了一些格式问题
14933a2初始提交

到目前为止这么好,但是(现在我已经重置)当我做<$ c $时

  d3810e4(origin / master)一些终端颜色变化
a7182d3 git颜色,忽略等
995fe8c添加了gitconfig,将某些个人内容移出公共回购
8a100b7 misc不重要更新
55d2c08添加了一个修复程序打开,重构
7ec7d83删除了一些vim颜色;添加一对搜索别名
330c7fc(HEAD,master)次要更新
44e80a1添加了vim文件
48537c6修复了一些格式问题
14933a2初始提交

请注意,最近的条目4df9421移动了一些别名,在此列表中缺失。



我的理解是, - all 选项应显示所有提交。为什么最近缺少一次我恢复到以前的提交?



谢谢。

解决方案

它缺少,因为它不是由HEAD或分支引用。

你已经将两个(HEAD和master)都重置为另一个提交,使用 git reset --hard



只有 git reflog 会向你显示最近提交的内容。

git log --all 仅适用于列出在 refs / (如tags,heads,...)中引用的提交

  




假装所有的 refs / 在命令行中列为< commit>



Can someone please help me understand what's happening here?

I start with git log --oneline, which spits out:

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

then I do git reset --hard 330c7fc which takes the log back to:

330c7fc (HEAD, master) Minor updates
44e80a1 Added vim files
48537c6 Fixed some formatting problems
14933a2 Initial Commit

So far so good, but (now that I've reset) when I do git log --oneline --all I get:

 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

Notice that the most recent entry, "4df9421 moved some aliases around", is missing from this list.

My understanding is that the --all option should display all the commits. Why is the latest missing once I revert to an earlier commit?

Thanks.

解决方案

It is missing, because it isn't reference anymore by HEAD or by a branch.
You have reset both (HEAD and master) to another commit, with your git reset --hard.

Only git reflog would show you that recent commit.

git log --all is only for listing commits referenced in refs/ (like tags, heads, ...)

--all

Pretend as if all the refs in refs/ are listed on the command line as <commit>.

这篇关于git --all丢失提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆