git log <filename> doesn't show commit, but git log shows commit that edited the file

心已入冬 提交于 2020-01-15 12:33:29

问题


I discovered this odd issue while looking for a lost change.

I typed in:

git log httpd.conf

I am getting a bunch of commit hashes as expected, but not the one I did.

When I type in:

git log

I see the commit I made. When I run:

git show <hash>

I see my edits to httpd.conf

Can anyone explain what may have happened? If there is more information needed to discover the root please let me know.


回答1:


From git docs (http://git-scm.com/docs/git-log):

Default mode - simplifies the history to the simplest history explaining the final state of the tree. Simplest because it prunes some side branches if the end result is the same (i.e. merging branches with the same content)

Try using:

git log --full-history

(Same as the default mode, but does not prune some history.)



来源:https://stackoverflow.com/questions/28303805/git-log-filename-doesnt-show-commit-but-git-log-shows-commit-that-edited-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!