3

(magit-stage-modified 'all) stages all modified files, but only after confirming it with the user with the message Stage all changes? (y or n).

The function is defined as follows:

(defun magit-stage-modified (&optional all)
  "Stage all changes to files modified in the worktree.
Stage all new content of tracked files and remove tracked files
that no longer exist in the working tree from the index also.
With a prefix argument also stage previously untracked (but not
ignored) files."
  (interactive "P")
  (when (magit-anything-staged-p)
    (magit-confirm 'stage-all-changes))
  (magit-with-toplevel
    (magit-stage-1 (if all "--all" "-u"))))

There does not appear to be any guard that I can set that will allow me to stage all modified files without a confirmation.

Is there a way to achieve this otherwise?

1 Answer 1

7

Possible next steps in an attempt to find the appropriate configuration mechanism by looking at the source code are to either look at the definition of magit-confirm or grep for "stage-all-changes".

Either one will lead, more or less directly, to the option magit-no-confirm and after reading its doc-string you will know that you can disable confirmation using:

(add-to-list 'magit-no-confirm 'stage-all-changes)
1
  • Fantastic support as always, @tarsius. And I appreciate that you not only published the answer, but also a strategy for similar situations. Commented Feb 16, 2018 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.