Function: magit-submodule-add

magit-submodule-add is an autoloaded, interactive and byte-compiled function defined in magit-submodule.el.

Signature

(magit-submodule-add ARG1 &optional ARG2 ARG3 ARG4)

Documentation

Add the repository at URL as a module.

Optional PATH is the path to the module relative to the root of the superproject. If it is nil, then the path is determined based on the URL. Optional NAME is the name of the module. If it is nil, then PATH also becomes the name.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-submodule.el
;;;###autoload(autoload 'magit-submodule-add "magit-submodule" nil t)
(transient-define-suffix magit-submodule-add (url &optional path name args)
  "Add the repository at URL as a module.

Optional PATH is the path to the module relative to the root of
the superproject.  If it is nil, then the path is determined
based on the URL.  Optional NAME is the name of the module.  If
it is nil, then PATH also becomes the name."
  :class 'magit--git-submodule-suffix
  :description "Add            git submodule add [--force]"
  (interactive
    (magit-with-toplevel
      (let* ((url (magit-read-string-ns "Add submodule (remote url)"))
             (path (magit-submodule-read-path "Add submodules at path: " url)))
        (list url
              (directory-file-name path)
              (magit-submodule-read-name-for-path path)
              (magit-submodule-arguments "--force")))))
  (magit-submodule-add-1 url path name args))