Git diff and git stack save all uncommitted modifications (workspace and staging) to the stack for subsequent recovery of the current working directory


1. View and modify

$git diff # compare workspace (not git add) and staging area (after git add)
$git diff -- cached # compare the staging area (after git add) and the version Library (after git commit)
$git diff head # compare workspace (not git add) and version Library (after git commit)

2. Hide modification

$git stash # hide changes
$git stash list # view stash content
$git stash apply # restores the modification without deleting the stash content
$git stash drop # delete the contents of stash
$git stash pop # restores modifications and deletes stash content

Note: the newly added files will not be stored by directly executing the stash, that is, the files that are not in Git version control cannot be saved by git stash.