Function: magit-stash-push

magit-stash-push is an autoloaded, interactive and byte-compiled function defined in magit-stash.el.

Signature

(magit-stash-push &optional ARG1 ARG2)

Documentation

Create stash using "git stash push".

This differs from Magit's other stashing commands, which don't use "git stash" and are generally more flexible but don't allow specifying a list of files to be stashed.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-stash.el
;;;###autoload(autoload 'magit-stash-push "magit-stash" nil t)
(transient-define-prefix magit-stash-push (&optional transient args)
  "Create stash using \"git stash push\".

This differs from Magit's other stashing commands, which don't
use \"git stash\" and are generally more flexible but don't allow
specifying a list of files to be stashed."
  :man-page "git-stash"
  ["Arguments"
   (magit:-- :reader (lambda (prompt initial-input history)
                       (magit-read-files prompt initial-input history
                                         #'magit-modified-files)))
   ("-u" "Also save untracked files" ("-u" "--include-untracked"))
   ("-a" "Also save untracked and ignored files" ("-a" "--all"))
   ("-k" "Keep index" ("-k" "--keep-index"))
   ("-K" "Don't keep index" "--no-keep-index")]
  ["Actions"
   ("P" "push" magit-stash-push)]
  (interactive (if (eq transient-current-command 'magit-stash-push)
                   (list nil (transient-args 'magit-stash-push))
                 (list t)))
  (if transient
      (transient-setup 'magit-stash-push)
    (magit-run-git "stash" "push"
                   (seq-filter #'atom args)
                   (assoc "--" args))))