Function: magit-log-buffer-file

magit-log-buffer-file is an interactive and natively 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

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/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")))