两点之间的差别..?和脱字符号/帽子象征^?在git中 - Difference between double-dot “..” and caret / hat symbol “^” in git

- 此内容更新于:2016-02-02
主题:

当我想要找到的提交分支而不是分支我经常写但根据帖子我怎么看到git提交分支机构之间的差异?以下做同样的事:这些命令是相同的吗?的区别是什么?

原文:

When I want to find the commits that are in branch A but not in branch B I often write

git log A ^ B

But according to the SO post How do I see the commit differences between branches in git? the following does the same thing:

git log B..A

Are these commands identical? What is the difference?

解决方案:
官方文档的覆盖历史简化我们发现:——ancestry-path当给定一个范围的承诺来显示(如commit1..commit2或commit2^commit1),只显示提交之间存在直接在血统上链commit1commit2,即提交都是commit1的后代,祖先commit2。似乎从文档本身和行为完全相同,并和运营商可以交替使用git日志。
原文:

From the official documentation for git log covering History Simplification we find:

--ancestry-path
When given a range of commits to display (e.g. commit1..commit2 or commit2 ^commit1), only display commits that exist directly on the ancestry chain between the commit1 and commit2, i.e. commits that are both descendants of commit1, and ancestors of commit2.

It seems from the documentation itself that either git log ^ B and git log A..B behave identically, and the ^ and .. operators can be used interchangeably with git log.

网友:他们是不同的运营商,就在这种情况下他们给了相同的结果。例如你可以有多个在一行

(原文:They are different operators, just in this case they gave the same result. E.g. You could have multiple ^commit-ish in one line)

网友:@Alexey是的,特别我的回答说,这些操作符是可互换的。

(原文:@Alexey Yes, my answer specifically says that these operators are interchangeable in the case of git log.)

网友:边注:更准确考虑的简写,因为操作符可以用于更复杂的裁判规范。这样一个规范可以采取的形式。

(原文:On a side note: It would be more accurate to consider A..B a shorthand of A ^B, since the ^ operator can be used for more complex ref specs. Such a spec could simply take the form of A ^B ^C.)