Function: magit-file-untrack
magit-file-untrack is an interactive and natively compiled function
defined in magit-files.el.
Signature
(magit-file-untrack FILES &optional FORCE)
Documentation
Untrack the selected FILES or one file read in the minibuffer.
With a prefix argument FORCE do so even when the files have staged as well as unstaged changes.
Key Bindings
magit-diff-section-base-map <remap> <magit-file-untrack> magit-diff-section-map <remap> <magit-file-untrack> magit-mode-map K
Source Code
;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/magit-files.el
;;;###autoload
(defun magit-file-untrack (files &optional force)
"Untrack the selected FILES or one file read in the minibuffer.
With a prefix argument FORCE do so even when the files have
staged as well as unstaged changes."
(interactive (list (or (if-let ((files (magit-region-values 'file t)))
(if (magit-file-tracked-p (car files))
(magit-confirm-files 'untrack files "Untrack")
(user-error "Already untracked"))
(list (magit-read-tracked-file "Untrack file" t))))
current-prefix-arg))
(magit-with-toplevel
(magit-run-git "rm" "--cached" (and force "--force") "--" files)))