Reputation: 11171
I'm kind of stumped here. Git appears is both telling me that
One of these is a lie (or more likely, I'm misunderstanding this scenario). What's up with this??
(~/hbb.vm) debian $ git diff ..stage/master --name-only
sites/all/libraries/attachment_email/attachment_email.php
sites/all/modules/redirect/redirect.module
sites/all/modules/redirect/redirect.test
sites/all/themes/HBB/css/elements.css
sites/all/themes/HBB/templates/node--enterprise_blog.tpl.php
(~/hbb.vm) debian $ git merge stage/master
Already up-to-date.
Upvotes: 3
Views: 1675
Reputation: 20739
You're correct in assuming 1.: There're differences between where you're at (HEAD
) and stage/master
.
Any of these tell you this:
git diff ..stage/master
git diff HEAD..stage/master
git diff stage/master..
git diff stage/master..HEAD
1 is short-hand for 2, and 3 for 4. 3 is just the reverse diff of 1.
git diff stage/master
that @qqx mentioned will further tell you of any differences between your working-tree and stage/master
. (Compared to 1 or 3, you'll also see uncommitted changes.)
You're incorrect in thinking 2.: There are no differences between HEAD
and stage/master
.
Rather, git merge stage/master
is telling you that there're no commits in stage/master
that aren't already in (or merged to) HEAD
.
This might also tell you this:
git log ...stage/master --cherry-pick
And this might tell you of the commits that're causing the diff after you've merged stage/master
:
git log stage/master... --cherry-pick
Upvotes: 1
Reputation: 19465
The merge command is telling you that your current branch contains all of the
commits from the stage/master
branch, but not the reverse. It is likely that
your current branch contains changes which aren't in stage/master
and it is
those changes which are being reflected in your diff command.
a-b----c
\
d--e
With the above repository if I have e
checked out, trying to merge b
will
correctly state that things are up to date. But asking for differences between
my current state and that same point, it's likely that differences will be
present (not guaranteed, e
could revert the changes from d
or both e
and
d
could be empty commits).
BTW, your diff command is somewhat incorrect. The ..
in front of the branch
name causes that to be interpreted as a range of commits (equivalent to
HEAD..stage/master
), but diff operates on individual commits rather than
ranges. This is a somewhat common mistake so diff has been adjusted to somewhat
allow for it, but it can still give misleading results. In this case it will
show changes reversed from what you'd likely expect showing the changes needed
to go from your current state to stage/master
rather than the changes that
took place to bring the state from stage/master
to the state reflected by the
tip of your current branch. The latter is more likely be be what you were
expecting.
Upvotes: 4