Function: vc-git-stash-snapshot

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

Signature

(vc-git-stash-snapshot)

Documentation

Create a stash with the current uncommitted changes.

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-snapshot ()
  "Create a stash with the current uncommitted changes.
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)
  (apply #'vc-git--call nil nil "stash" "push" "-m"
	 (format-time-string "Snapshot on %Y-%m-%d at %H:%M")
         (vc-git--deduce-files-for-stash))
  (vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" "stash@{0}")
  (vc-resynch-buffer (vc-git-root default-directory) t t))