Function: magit-log-buffer-file

magit-log-buffer-file is an autoloaded, interactive and byte-compiled function defined in magit-log.el.

Signature

(magit-log-buffer-file &optional FOLLOW BEG END)

Documentation

Show log for the blob or file visited in the current buffer.

With a prefix argument or when --follow is an active log argument, then follow renames. When the region is active, restrict the log to the lines that the region touches.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-log.el
;;;###autoload
(defun magit-log-buffer-file (&optional follow beg end)
  "Show log for the blob or file visited in the current buffer.
With a prefix argument or when `--follow' is an active log
argument, then follow renames.  When the region is active,
restrict the log to the lines that the region touches."
  (interactive (cons current-prefix-arg (magit-file-region-line-numbers)))
  (require 'magit)
  (if-let ((file (magit-file-relative-name)))
      (magit-log-setup-buffer
       (list (or magit-buffer-revision
                 (magit-get-current-branch)
                 "HEAD"))
       (let ((args (car (magit-log-arguments))))
         (when (and follow (not (member "--follow" args)))
           (push "--follow" args))
         (when (and beg end)
           (setq args (cons (format "-L%s,%s:%s" beg end file)
                            (cl-delete "-L" args :test
                                       #'string-prefix-p)))
           (setq file nil))
         args)
       (and file (list file))
       magit-log-buffer-file-locked)
    (user-error "Buffer isn't visiting a file")))