branch: elpa/git-commit commit 6ba3b50373fffa89ae99fc0ad5135e3d574f6df4 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-stash-push: New command Closes #4583. --- lisp/magit-stash.el | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lisp/magit-stash.el b/lisp/magit-stash.el index ecaf38797a..7521256c29 100644 --- a/lisp/magit-stash.el +++ b/lisp/magit-stash.el @@ -96,7 +96,8 @@ AUTHOR-WIDTH has to be an integer. When the name of the author ("z" "both" magit-stash-both) ("i" "index" magit-stash-index) ("w" "worktree" magit-stash-worktree) - ("x" "keeping index" magit-stash-keep-index)] + ("x" "keeping index" magit-stash-keep-index) + ("P" "push" magit-stash-push :level 5)] ["Snapshot" ("Z" "both" magit-snapshot-both) ("I" "index" magit-snapshot-index) @@ -211,6 +212,30 @@ while two prefix arguments are equivalent to `--all'." (magit-stash-save (concat "WIP on " (magit-stash-summary)) index worktree untracked refresh t)) +;;;###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 ,(-rpartial #'magit-read-files + #'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" args))) + ;;;###autoload (defun magit-stash-apply (stash) "Apply a stash to the working tree.