Function: magit-branch-merged-p
magit-branch-merged-p is a natively compiled function defined in
magit-git.el.
Signature
(magit-branch-merged-p BRANCH &optional TARGET)
Documentation
Return non-nil if BRANCH is merged into its upstream and TARGET.
TARGET defaults to the current branch. If HEAD is detached and
TARGET is nil, then always return nil. As a special case, if
TARGET is t, then return non-nil if BRANCH is merged into any one
of the other local branches.
If, and only if, BRANCH has an upstream, then only return non-nil if BRANCH is merged into both TARGET (as described above) as well as into its upstream.
Source Code
;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/magit-git.el
(defun magit-branch-merged-p (branch &optional target)
"Return non-nil if BRANCH is merged into its upstream and TARGET.
TARGET defaults to the current branch. If `HEAD' is detached and
TARGET is nil, then always return nil. As a special case, if
TARGET is t, then return non-nil if BRANCH is merged into any one
of the other local branches.
If, and only if, BRANCH has an upstream, then only return non-nil
if BRANCH is merged into both TARGET (as described above) as well
as into its upstream."
(and (if-let ((upstream (and (magit-branch-p branch)
(magit-get-upstream-branch branch))))
(magit-rev-ancestor-p branch upstream)
t)
(cond-let
((eq target t)
(delete (magit-name-local-branch branch)
(magit-list-containing-branches branch)))
([target (or target (magit-get-current-branch))]
(magit-rev-ancestor-p branch target)))))