9

I want to directly compare the diffs of two commits in emacs (rather than seeing the diff of two trees at given commit points).

A bonus would be being able to use ediff mode to compare the two buffers.

However there seems to be no way to have two *magit-revision* buffers open at once. Even if I rename the first, (magit-visit-ref) still updates that buffer.

I've looked through the manuals but couldn't find a reference to what controls the new buffer creation. Any ideas?

phils
  • 48,657
  • 3
  • 76
  • 115
stsquad
  • 4,626
  • 28
  • 45

2 Answers2

10

You can do it from the magit-log buffer

  • M-x magit-log
  • E r ref1..ref2
djangoliv
  • 3,169
  • 16
  • 31
  • You can do it from the status buffer too (although seeing the log will help to find the refs, of course) – npostavs Oct 20 '16 at 13:39
  • This does get what I want, almost, is it possible to show the revisions side by side for all files or do I need to compare a file at a time? – stsquad Oct 20 '16 at 13:46
  • you need to compare a file at a time. – djangoliv Oct 21 '16 at 06:55
  • brilliant, should be the answer. I wonder if there is a way to Ediff bunch of files from one commit to another rather than Ediffing files one by one between these two commits. – doctorate Jan 08 '23 at 20:12
5

Based on Kyle Meyer's comment to the OP -- thanks, Kyle.

It seems that what you want is to see the diffs associated with the two commits in two separate magit-revision buffers. You can accomplish this by loading up the first diff in the usual way (e.g. by hitting RET on it in a log view), running M-x magit-toggle-buffer-lock so that the buffer becomes pinned to that particular view, and then loading up the second diff in the usual way.

Without M-x magit-toggle-buffer-lock, Magit would reuse the buffer containing the first diff, erasing it and putting the second diff there instead. With M-x magit-toggle-buffer-lock, Magit is "forced" to create a new buffer for the second diff, which is what you want.

Note that djangoliv's answer does something different; it starts up an ediff session comparing the versions of a file from two different different commits.

kini
  • 344
  • 2
  • 4