Here’s a really nice tip from Wilfred Hughes’ Emacs Command of the Day Twitter feed:
M-x magit-log-buffer-file: shows all the commits that affected the current file. Great for understanding the history of some code! pic.twitter.com/psiuHb2cQm
— Ⓔ Command of the Day (@ecotd) November 18, 2017
This is just the thing if you need to examine to the commit history for a particular file. I ran it on one of my oldest files in Git (9 years) and could see all the changes in a buffer of only 161 lines instead of trying to pick them out from the thousands of lines in a full log listing.
Take a look at the documentation to see some additional capabilities of the command. You can, for instance, select a region in the current buffer and the command will show only the commits that affected those lines.
You can, of course, do the same thing interactively from the Magit menu but not as easily. If you find yourself needing to examine the commit history of a single file (semi-)regularly, it’s worthwhile remembering the