2

I'd like to browse the history of a specific file version by version. Ideally, as I step through history I should compare it with the closest previous version.

m33lky
  • 297
  • 3
  • 9

1 Answers1

4

I think commands magit-log-buffer-file and its variant magit-log-buffer-file-popup are what you are looking for. These are bound to l and L in Magit buffers, respectively. Invoking the former command within a version-controlled-file-visiting buffer (i.e. by typing M-x magit-log-buffer-file) skips the popup and displays the log directly. Within the resulting log buffer, you can use keys like DEL and RET to show/scroll and visit the commit at point, and n and p to move point back and forth in history, respectively.

Note that you can limit the history to any number of files in both popups using the =f option.

Edit

See also tarsius' mention of globbing functionality and answers to a near-duplicate question.

Addendum

If you enable magit-file-mode/global-magit-file-mode, then you can access the aforementioned log commands via magit-file-popup, which is bound to C-c M-g by default. Thus, instead of typing M-x magit-log-buffer-file or M-x magit-log-buffer-file-popup, you can instead type C-c M-g l or C-c M-g L, respectively.

Basil
  • 12,019
  • 43
  • 69