Fork me on GitHub
#spacemacs
<
2017-11-08
>
eggsyntax18:11:17

Anyone aware of a way to use magit to do git diff branch-a...branch-b?

chris18:11:52

you can use diff for range

eggsyntax18:11:42

Oh, so then you would literally type branch-a...branch-b for the range?

chris18:11:27

I believe you can? I was on branch-a and did diff for range and typed branch-b

chris18:11:34

which seemed like it worked

eggsyntax18:11:50

Yeah, at least at 1st glance that looks like it works.

eggsyntax18:11:19

I think if you type just branch-b, you'd get branch-a..branch-b with two dots, not branch-a...branch-b.

eggsyntax18:11:35

Yeah, confirmed

chris18:11:40

oh, I didn't even see there was a difference

chris18:11:48

what's the difference?

eggsyntax18:11:51

Yeah, not a very well-advertised one 😛

eggsyntax18:11:20

three dots means just show the changes made on branch-b, ie don't show commits that have been made on branch-a and not merged to branch-b.

chris18:11:31

oh, that's interesting

chris18:11:44

I thought I knew a lot about git, turns out there are whole corners that lay undiscovered

eggsyntax18:11:48

But actually typing branch-a...branch-b in magit diff range did give me that.

eggsyntax18:11:00

Yeah, same here, I just discovered the triple-dot thing this year...

eggsyntax18:11:22

Which is why IMO a tool like magit is so awesome: it provides more affordances to guide you in discovering git's capabilities. Which is what all the tools like SourceTree kinda try to do too, but they're all pretty crippled...

eggsyntax18:11:38

At least the ones I've tried.

jeff.terrell18:11:24

@eggsyntax - I think the .. vs ... is the other way around. A..B gives everything in B but not A. A...B gives all commits unique to either. https://stackoverflow.com/questions/462974/what-are-the-differences-between-double-dot-and-triple-dot-in-git-com#24186641

jeff.terrell18:11:41

And agreed about git affordances! 👍

eggsyntax18:11:39

Whups, truth, got that backward. Thanks!

eggsyntax18:11:29

Weirdly, it may be reversed in magit. Or else I'm reading it wrong :thinking_face:

jeff.terrell18:11:48

That is weird! I'm interested to know what you figure out.

eggsyntax18:11:48

Something's really weird here.

[13:20] pages> git diff master...ui/debit-memo-add-real-data | wc
   1789    6591   76485

[13:38] pages> git diff master..ui/debit-memo-add-real-data | wc
   4382   17411  221281

eggsyntax18:11:58

Could that answer be wrong?

jeff.terrell18:11:31

That is weird. I wonder if diff is presenting things differently somehow. Can you try rev-list in place of diff and see what you get?

chris18:11:45

if this is the case in magit it seems like a bug in magit after reading pro git

jeff.terrell18:11:10

Have you read that? Me too. Good book!

chris18:11:58

it's an excellent book, but clearly I didn't internalize it because this is the first I'm seeing the difference in the double and triple dot syntax

chris18:11:06

I recommend it to everyone I teach about git

eggsyntax18:11:14

I see, it's just a bit confusing. I think the explanation in this answer is a lot clearer: https://stackoverflow.com/a/7256391/284564

chris18:11:14

scroll to "Double Dot" and "Triple Dot"

eggsyntax18:11:18

Meh, tried to post the relevant screenshot, but apparently clojurians is out of storage space 😆

jeff.terrell18:11:52

I see the screenshot. Nice explanation. So it was git diff after all. simple_smile

eggsyntax18:11:00

So .. is comparing tip to tip; ... is comparing divergence point to tip.