gitk has a feature where you select one commit, then right-click another and can choose to either "Diff this -> selected" or "Diff selected -> this".

Is something like this possible in magit-log? Meaning, place point on a commit, press something, place point on another commit, and get a diff between the two commits?

1 Answer 1


Press C-SPC (set-mark-command), move to the other commit, and press d d. Many other command that normally act on the thing at point, act on the things in the region instead when that is active. E.g. you could cherry-pick all commits in the region or stage all files in the region. d d is actually a special case because it only does something with the commits "at the edges of the region" instead of all the commits in the region.

  • Awesome, thanks Jonas! I'll just add that shift + arrow keys work too if you have that enabled. Apr 9, 2016 at 22:48
  • You can also stage just part of a hunk using the region. However in that case shift + arrow keys will behave a bit odd - the initial selection will be two lines in that case (so use C-SPC here).
    – tarsius
    Apr 9, 2016 at 22:53
  • I actually already knew that, and I've discovered that I can still stage just one line by confining the selection to a single line (i.e. using shift + left/right). This (especially + the discard action) is a killer feature :) Apr 9, 2016 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.