diff <commit> using 3-dot behavior

3 messages, 2 authors, 2016-08-24 · open the first message on its own page

diff <commit> using 3-dot behavior

From: Robert Dailey <hidden>
Date: 2016-08-24 14:28:33

I want to view the complete diff of my branch (topic) relative to its
parent branch (master). This should include cached/staged files and
unstaged working tree changes.

If I do this:

$ git diff master

This will include changes on master *since* my last merge, which I do
not want (I don't want to see changes on master, only on topic). I
tried this:

$ git diff master --not master

This didn't give me any output. If I do this:

$ git diff master...topic

This shows me only committed changes on topic, but excludes staged &
unstaged changes.

How can I get the results I want?

Re: diff <commit> using 3-dot behavior

From: Michael J Gruber <hidden>
Date: 2016-08-24 16:00:20

Robert Dailey venit, vidit, dixit 24.08.2016 16:28:
I want to view the complete diff of my branch (topic) relative to its
parent branch (master). This should include cached/staged files and
unstaged working tree changes.

If I do this:

$ git diff master

This will include changes on master *since* my last merge, which I do
not want (I don't want to see changes on master, only on topic). I
tried this:

$ git diff master --not master

This didn't give me any output. If I do this:

$ git diff master...topic

This shows me only committed changes on topic, but excludes staged &
unstaged changes.

How can I get the results I want?
The 3-dot notation means:

Show the difference between the merge-base of master and topic, and topic.

I'm not completely sure, but I guess what you want is:

Show the difference between the merge-base of master and topic, and the
worktree.

You can accomplish this with:

git diff $(git merge-base master topic)

I guess a shorter notation for that could come in handy. OTOH, I usually
diff against HEAD in a situation like that.

Cheers,
Michael

Re: diff <commit> using 3-dot behavior

From: Robert Dailey <hidden>
Date: 2016-08-24 16:11:02

On Wed, Aug 24, 2016 at 11:00 AM, Michael J Gruber
[off-list ref] wrote:
The 3-dot notation means:

Show the difference between the merge-base of master and topic, and topic.

I'm not completely sure, but I guess what you want is:

Show the difference between the merge-base of master and topic, and the
worktree.

You can accomplish this with:

git diff $(git merge-base master topic)

I guess a shorter notation for that could come in handy. OTOH, I usually
diff against HEAD in a situation like that.
Great solution. I feel silly now, the answer ended up being rather
obvious. I can create an alias for that. But I can't diff against HEAD
because then I am not seeing a diff of changes already committed.
Thanks for your help.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help