首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >这些git命令之间有什么区别?

这些git命令之间有什么区别?
EN

Stack Overflow用户
提问于 2014-12-08 20:49:41
回答 1查看 190关注 0票数 1

我在一个分支br上,它被推入为origin/br,在这个分支上我做了几次提交。在HEAD == br == origin/br的情况下,我运行以下两个命令:

代码语言:javascript
运行
复制
(1) git diff <some-commit>

代码语言:javascript
运行
复制
(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).

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-12-08 21:34:33

我打赌输出显示的是diff -cc $pathnameindex $sha1,$sha2..$sha3,有时沙的1,2,3中有两个是相同的,通过快速挖掘,我认为git可能将其中一个提交(中间)处理为一个显式合并基,另两个作为显式合并提示--但根据builtin/diff.c提供的这一点,您传递的参数是不正确的。

代码语言:javascript
运行
复制
/*
 * 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.
 */
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27366638

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档