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.


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.


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


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.

  • Once I'm in that view for my file how can I see ediff-style side-by-side diffs?
    – m33lky
    May 8 '17 at 15:56
  • 1
    @m33lky See here.
    – Basil
    May 8 '17 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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