Function: magit-log-merged
magit-log-merged is an autoloaded, interactive and byte-compiled
function defined in magit-log.el.
Signature
(magit-log-merged COMMIT BRANCH &optional ARGS FILES)
Documentation
Show log for the merge of COMMIT into BRANCH.
More precisely, find merge commit M that brought COMMIT into
BRANCH, and show the log of the range "M^1..M". If COMMIT is
directly on BRANCH, then show approximately
magit-log-merged-commit-count surrounding commits instead.
This command requires git-when-merged, which is available from https://github.com/mhagger/git-when-merged.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-log.el
;;;###autoload
(defun magit-log-merged (commit branch &optional args files)
"Show log for the merge of COMMIT into BRANCH.
More precisely, find merge commit M that brought COMMIT into
BRANCH, and show the log of the range \"M^1..M\". If COMMIT is
directly on BRANCH, then show approximately
`magit-log-merged-commit-count' surrounding commits instead.
This command requires git-when-merged, which is available from
https://github.com/mhagger/git-when-merged."
(interactive
(append (let ((commit (magit-read-branch-or-commit "Log merge of commit")))
(list commit
(magit-read-other-branch "Merged into" commit)))
(magit-log-arguments)))
(unless (magit-git-executable-find "git-when-merged")
(user-error "This command requires git-when-merged (%s)"
"https://github.com/mhagger/git-when-merged"))
(let (exit m)
(with-temp-buffer
(save-excursion
(setq exit (magit-process-git t "when-merged" "-c"
(magit-abbrev-arg)
commit branch)))
(setq m (buffer-substring-no-properties (point) (line-end-position))))
(if (zerop exit)
(magit-log-setup-buffer (list (format "%s^1..%s" m m))
args files nil commit)
;; Output: "<ref><lots of spaces><message>".
;; This is not the same as `string-trim'.
(setq m (string-trim-left (substring m (string-match " " m))))
(if (equal m "Commit is directly on this branch.")
(let* ((from (format "%s~%d" commit
(/ magit-log-merged-commit-count 2)))
(to (- (car (magit-rev-diff-count branch commit t))
(/ magit-log-merged-commit-count 2)))
(to (if (<= to 0)
branch
(format "%s~%s" branch to))))
(unless (magit-commit-p from)
(setq from (magit-git-string "rev-list" "--max-parents=0"
commit)))
(magit-log-setup-buffer (list (concat from ".." to))
(cons "--first-parent" args)
files nil commit))
(user-error "Could not find when %s was merged into %s: %s"
commit branch m)))))