Variable: magit-wip-merge-branch

magit-wip-merge-branch is a customizable variable defined in magit-wip.el.

Value

nil

Documentation

Whether to merge the current branch into its wip ref.

If non-nil and the current branch has new commits, then it is merged into the wip ref before creating a new wip commit. This makes it easier to inspect wip history and the wip commits are never garbage collected.

If nil and the current branch has new commits, then the wip ref is reset to the tip of the branch before creating a new wip commit. With this setting wip commits are eventually garbage collected. This is currently the default.

If immediately, then use git-commit-post-finish-hook to create the merge commit. This is discouraged because it can lead to a race condition, e.g., during rebases.

If githook, then use magit-common-git-post-commit-hook to create the merge commit. This uses the experimental support for calling Lisp hooks from Git hooks, which is disabled by default, Customize magit-overriding-githook-directory to enable use of Git hooks.

This variable was added, or its default value changed, in magit version 2.90.0.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-wip.el
(defcustom magit-wip-merge-branch nil
  "Whether to merge the current branch into its wip ref.

If non-nil and the current branch has new commits, then it is
merged into the wip ref before creating a new wip commit.  This
makes it easier to inspect wip history and the wip commits are
never garbage collected.

If nil and the current branch has new commits, then the wip ref
is reset to the tip of the branch before creating a new wip
commit.  With this setting wip commits are eventually garbage
collected.  This is currently the default.

If `immediately', then use `git-commit-post-finish-hook' to
create the merge commit.  This is discouraged because it can
lead to a race condition, e.g., during rebases.

If `githook', then use `magit-common-git-post-commit-hook' to
create the merge commit.  This uses the experimental support for
calling Lisp hooks from Git hooks, which is disabled by default,
Customize `magit-overriding-githook-directory' to enable use of
Git hooks."
  :package-version '(magit . "2.90.0")
  :group 'magit-wip
  :set (lambda (symbol value)
         (set-default-toplevel-value symbol value)
         (when (bound-and-true-p magit-wip-mode)
           (if (eq value 'immediately)
               (add-hook 'git-commit-post-finish-hook #'magit-wip-commit)
             (remove-hook 'git-commit-post-finish-hook #'magit-wip-commit))))
  :type '(choice
          (const :tag "Yes (safely, just in time)" t)
          (const :tag "Yes (immediately, with race condition)" immediately)
          (const :tag "Yes (using experimental Git hook support)" githook)
          (const :tag "No" nil)))