`..` vs `...`

To see the code diff in feature branch?

git diff master...feature

To see the commits added in feature branch?

git log master..feature

Explanation for git diff

Use the three dots like this git diff [<options>] <commit>...<commit>.

  B---C---D master (Branch)
 /
A
 \
  H---I feature (Branch)

Two dots - show the diffs between all changes on both sides, use the git diff master..feature, output: (diff of H, I against B, C, D)

Three dots - to show the diffs between the last common ancestor (A), aka the commit we started the feature branch, use git diff master...feature, output: (diff of H, I against A).

Note that … and .. don’t have the same meaning in git log

However, “diff” is about comparing two endpoints, not ranges, and the range notations (“..” and “”) do not mean a range as defined in the “SPECIFYING RANGES” section in gitrevisions[7].

from git diff --help

Explanation for git log

Kind of like reversing the meaning for ... and .. in git diff

git log master..feature

# equivalent to

git log ^master feature

# refers to commit `H and I`
git log master...feature

# equivalent to

git log master feature --not $(git merge-base --all master feature)

# refers to commit `B, C,D, H and I`

See man gitrevision under SPECIFYING RANGES section

See also

The best stack overflow explanation see here