Function: vc-git-stash

vc-git-stash is an interactive and byte-compiled function defined in vc-git.el.gz.

Signature

(vc-git-stash NAME)

Documentation

Create a stash named NAME.

In vc-dir-mode, if there are files marked, stash the changes to those. If no files are marked, stash all uncommitted changes to tracked files. In other modes, call vc-deduce-fileset to determine files to stash.

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defun vc-git-stash (name)
  "Create a stash named NAME.
In `vc-dir-mode', if there are files marked, stash the changes to those.
If no files are marked, stash all uncommitted changes to tracked files.
In other modes, call `vc-deduce-fileset' to determine files to stash."
  (interactive "sStash name: ")
  (let ((root (vc-git-root default-directory)))
    (when root
      (apply #'vc-git--call nil nil "stash" "push" "-m" name
             (vc-git--deduce-files-for-stash))
      (vc-resynch-buffer root t t))))