Original: http://gitbook.liuhui998.com/4_5.html
I. Basic operation when you are doing a complex job, you find a bug that is not relevant to your current job but is annoying. You want to fix the bug and do the work at hand, then you can use Git stash to save the current state of work, after you fix the bug, the "anti-storage" (Unstash) operation can go back to the previous work. $ git stash save "working in Progres S for Foo feature "This command will save your local modifications to the storage (stash), and then reset all your working directory and index contents back to the state of the last commit of your current branch. OK, you can start your repair work now .... Edit and test ... $ git commit-a-M "Blorpl:typofix" after you fix the bug, you can use Git stash apply to revert to the previous working state. ?? The code that modifies the bug will be submitted and will remain in the local code after apply? $ git stash apply second, storage queue you can also use the ' git stash ' command multiple times, and each time you execute it, the ' storage ' (stash) for the current modification is added to the storage queue. Use the ' Git Stash list ' command to view your saved ' storage ' (stashes): $>git stash List[email protected]{0}: WIP on book:51bea1d ... fixed images[em Ail protected]{1}: WIP on Master:9705ae6 ... changed the browse code to the official repo can be used like ' git stash apply ' [email prot ected]{1} ' command to use any of the ' storage ' (stashes) in the queue. ' Git stash clear ' is used to empty this queue.
Git Stash Introduction