git stash use

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https: //blog.csdn.net/daguanjia11/article/details/73810577
a blog we use the git checkout command to switch on a branch.
We sometimes encounter such a situation, being dev branch to develop new features, so that when someone came half a feedback bug, let immediately resolved, but new features you do not want to submit half, then you can use the git stash command first the current progress saved, and then switch to another branch to modify the bug, after modifying submit, then cut back to the dev branch, use the progress before git stash pop to restore continue to develop new features. The following look at git stash command of common usage

git stash
save the current progress of work, the changes will save up staging area and workspace. After executing this command, run git status command, you will find the current work area is a clean, no changes. Use git stash save 'message ...' you can add some comments

git stash list
displays a list of saved schedule. Which means, git stash command can be executed multiple times.

POP stash git [-index] [stash_id]
git stash POP to restore the latest progress of the work area. git will change the default work area and temporary area are restored to the workspace.
git stash pop --index restore the latest progress of the work area and the staging area. (Try to change the original staging area is also restored to the staging area)
git stash stash @ POP progress of recovery specified {1} to the workspace. stash_id is obtained by the git stash list command
by command git stash pop recovery progress will delete the current schedule.
git stash apply [-index] [stash_id ]
In addition to not delete the progress of recovery, rest and git stash pop command.

git stash drop [stash_id]
Progress delete a store. If you do not specify stash_id, delete the default storage latest progress.

git stash clear
delete all stored schedule.

Guess you like

Origin www.cnblogs.com/singworld/p/11672757.html