git branch - Spurious change when using git diff <base>...<feature> -
github seems use triple dot comparison on pull requests, tricked me today showing spurious change between feature , base branch.
here base branch (abbreviated):
git show upstream/develop:script.sql field in ( [001*a], [001*d], [001*y], [001*x], [001*z], [004*a], [008*a], [008*d], [008*j], [008*l], [008*o], [009*a], [009*b], [009*g], [009*x], [009*u], [041*a], [041*c],
here feature branch (abbreviated):
git show feature:script.sql field in ( [001*a], [001*d], [001*y], [001*x], [001*z], [004*a], [008*a], [008*d], [008*j], [008*l], [008*o], [009*a], [009*b], [009*g], [009*x], [009*u], [041*a], [041*c],
here output plain diff:
git diff upstream/develop feature script.sql
(no output.)
here output "changed on feature branch"-triple dot operator diff:
git diff upstream/develop...feature script.sql field in ( [001*a], [001*d], [001*y], [001*x], [001*z], + [004*a], [008*a], [008*d], [008*j], [008*l], [008*o],
why?
there no change on line. adding -w
shouldn't necessary since plain diff above run without , reported no change.
from git diff
git diff [--options] [--] [...]
this view changes between 2 arbitrary < commit >.
...
git diff [--options] ... [--] [...]
this form view changes on branch containing , second , starting @ common ancestor of both . "git diff a...b" equivalent "git diff $(git-merge-base b) b". can omit 1 of , has same effect using head instead.
...
however, "diff" comparing 2 endpoints, not ranges, , range notations (".." , "...") not mean range defined in "specifying ranges" section in git-rev-parse(1)
assuming have 2 branches
a-b-c-d (branch1) \ e-f (branch2)
git diff branch1 branch2 myfile
give diff between file content in d , f.
git diff branch1...branch2
give diff between file content in b , f.
in case [004*a],
may have been included in both branches, after b.
Comments
Post a Comment