我在一个分支br上,它被推入为origin/br,在这个分支上我做了几次提交。在HEAD == br == origin/br的情况下,我运行以下两个命令:
(1) git diff <some-commit>和
(2) git diff <some-commit> HEAD origin/br其中HEAD是<some-commit>的直接后代
两者给出了不同的结果,虽然我理解(1)做什么,但我不知道(2)正在打印什么。(2)是做什么的?我相信这与手册页的这一条目有关,但我不知道它的意思:
<path>... The <paths> parameters, when given, are used to limit the diff to the named paths (you can give directory names and get diff for all files under them).
发布于 2014-12-08 21:34:33
我打赌输出显示的是diff -cc $pathname和index $sha1,$sha2..$sha3,有时沙的1,2,3中有两个是相同的,通过快速挖掘,我认为git可能将其中一个提交(中间)处理为一个显式合并基,另两个作为显式合并提示--但根据builtin/diff.c提供的这一点,您传递的参数是不正确的。
/*
* We could get N tree-ish in the rev.pending_objects list.
* Also there could be M blobs there, and P pathspecs.
*
* N=0, M=0:
* cache vs files (diff-files)
* N=0, M=2:
* compare two random blobs. P must be zero.
* N=0, M=1, P=1:
* compare a blob with a working tree file.
*
* N=1, M=0:
* tree vs cache (diff-index --cached)
*
* N=2, M=0:
* tree vs tree (diff-tree)
*
* N=0, M=0, P=2:
* compare two filesystem entities (aka --no-index).
*
* Other cases are errors.
*/https://stackoverflow.com/questions/27366638
复制相似问题