3

With git I can see the differences in a file relative to any other past commit as:

git diff commit file_name

This shows me the differences in file_name between the version in commit against my current unstaged changes.

With Magit I can choose a given commit with . in the log and compare it with another commit with =. However I do not see my unstaged changes in the log so how can I select them to make the comparison?

Thank you in advance.

Alejandro
  • 1,064
  • 1
  • 8
  • 22

1 Answers1

7

When in the main magit view (which you get after calling magit-status), you can press d to get a menu of all diff commands. Then press r (range) to diff against a specific commit (which is prompted in the minibuffer).

If you want the exact equivalent to your git command line and limit the diff to a specific file, then press =f before r (as always with magit, the "popup" is self-explanatory).

The complete sequence to get an equivalent of git diff commit file_name is thus :

  • d
  • =ffile_nameRET
  • rcommitRET
François Févotte
  • 19,520
  • 4
  • 51
  • 74