git learning notes 05--git stash
An excerpt from the Git authoritative guide
Git stash is used to save and restore work progress.
Git stash
Saves the current work progress. The state of the staging area and workspace are saved separately.
git stash List
Displays a list of progress. This command clearly implies that git stash can save the work progress multiple times and select it at the time of recovery.
git stash pop [--index] [<stash>]
If you do not use any parameters, the latest saved work progress is restored and the work progress of the recovery is purged from the stored work progress list.
If you provide a <stash> parameter (from the list displayed by the Git stash), recover from that <stash>. The restore will also remove <stash> from the progress list.
Option--index try to restore staging area in addition to the files in the workspace. This is why the status shown at the beginning of this chapter is slightly different from the time it was saved before the progress was resumed.
git stash [save [--patch] [-k|--[no]keep-index] [-q|--quiet] [<message>]
This command is actually the full version of the first git stash command. That is, if you need to use the specified description when saving your work progress, you must use the following format:
Git stash save "message ..."
Using the parameter--patch will show the difference between the workspace and head, and by editing the diff file, you can exclude extraneous content from the progress by editing the diff file to determine the content of the workspace that will eventually be saved in progress.
Using the-K or the--keep-index parameter, the staging area is not reset after the progress is saved. By default, the staging area and workspace are forced to reset.
git stash apply [--index] [<stash>]
In addition to not removing the progress of the recovery, the rest is the same as the Git stash pop command.
git stash drop [<stash>]
Deletes the progress of a store. The latest progress is deleted by default.
Git stash Clear
Deletes the progress of all the stores.
git Stash Branch <branchname> <stash>
Create a branch based on progress.