Why can't I do git diff on this specific commit?

陌路散爱 提交于 2019-12-12 06:27:49

问题


This works fine:

[git@hbhriq]$ git diff ..ers-gr-patch --name-only
sites/all/modules/brd_form_alters/brd_form_alters.module
sites/all/modules/brd_social/brd_social.module
sites/all/modules/globalredirect/globalredirect.module

But @qqx points out in one of my other recent posts that using ..erg-gr-patch is not really the right way to do things. Unfortunately, the alternative fails:

[git@hbhriq]$ git diff ers-gr-patch --name-only
error: bad tree object ers-gr-patch

@qqx said the following about ..branch_name:

BTW, your diff command is somewhat incorrect. The .. in front of the branch name causes that to be interpreted as a range of commits (equivalent to HEAD..stage/master), but diff operates on individual commits rather than ranges. This is a somewhat common mistake so diff has been adjusted to somewhat allow for it, but it can still give misleading results. In this case it will show changes reversed from what you'd likely expect showing the changes needed to go from your current state to stage/master rather than the changes that took place to bring the state from stage/master to the state reflected by the tip of your current branch. The latter is more likely be be what you were expecting.

Can someone help me understand what the problem is?

来源:https://stackoverflow.com/questions/17996531/why-cant-i-do-git-diff-on-this-specific-commit

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