feature
branch?git diff master...feature
feature
branch?git log master..feature
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
).
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
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
The best stack overflow explanation see here