Function: magit-gitignore-in-subdir

magit-gitignore-in-subdir is an autoloaded, interactive and byte-compiled function defined in magit-gitignore.el.

Signature

(magit-gitignore-in-subdir ARG1 ARG2)

Documentation

Add the Git ignore RULE to a ".gitignore" file in DIRECTORY.

Prompt the user for a directory and add the rule to the
".gitignore" file in that directory. Since such files are
tracked, they are shared with other clones of the repository. Also stage the file.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-gitignore.el
;;;###autoload(autoload 'magit-gitignore-in-subdir "magit-gitignore" nil t)
(transient-define-suffix magit-gitignore-in-subdir (rule directory)
  "Add the Git ignore RULE to a \".gitignore\" file in DIRECTORY.
Prompt the user for a directory and add the rule to the
\".gitignore\" file in that directory.  Since such files are
tracked, they are shared with other clones of the repository.
Also stage the file."
  :description "shared in subdirectory (path/to/.gitignore)"
  (interactive (let ((dir (expand-file-name
                           (read-directory-name
                            "Limit rule to files in: "
                            (and$ (magit-current-file)
                                  (file-name-directory
                                   (expand-file-name $ (magit-toplevel))))))))
                 (list (magit-gitignore-read-pattern dir) dir)))
  (magit--gitignore rule (expand-file-name ".gitignore" directory) t))