Git stash can be used to stage the current work, such as to pull the latest code, do not want to add a new commit, or another situation, in order to fix an urgent bug, first stash, so that return to their previous commit, change the bug after the stash pop, Continue the original work.
Basic command:
$git Stash
$do some work
$git Stash Pop
Advanced:
git stash Save "work on progress forfoo feature"
When you use the ' git stash ' command multiple times , your stack will be filled with uncommitted code, and you'll be confused about which version to apply back,
'git stash list' command can print the current git stack information, you just need to find the corresponding version number, for example, using 'git stash apply [email protected]{1} ' You can specify the version number as [Email protected] The work of {1} is taken out and when you apply all the stacks back, you can use 'git stash clear' to empty the stack.
git stash # Save uncommitted changes# Pull, edit, Etc.git stash list # list stashed changes in this gitgit show [E Mail protected]{0} # See the last stash git stash pops # Apply last stash and remove it from the Listgit stash--help
# for more info
Git stash: Backs up the contents of the current workspace, reads the content from the most recent commit, and makes the workspace guarantee consistent with the last commit. At the same time, save the current workspace content to the git stack.
Git stash pop: reads the last saved content from the Git stack and restores the workspace. Because there may be multiple stash content, the pop reads the content from the most recent stash and recovers it by using a stack to manage it.
Git stash list: Displays all the backups in the GIT stack and can use this list to decide where to recover from.
Git stash clear: Empty the git stack. Using graphical tools such as GITG, you will find out which nodes of the original stash have disappeared.
About Git's stash command