1. stash current modification git stash will all uncommitted changes (including staging and non-staging of) are saved, the current working directory for subsequent recovery. For example, the following intermediate state, by git stash command to push a new store, the current working directory is clean. Status git $ the On Branch Master Changes to BE committed: new new File: the style.css Changes not staged for the commit: Modified: index.html $ git stash the Saved Working Directory and index State WIP ON Master: Our new new Homepage 5002d47 the HEAD IS AT 5002d47 now new new Homepage Our $ git Status the on Branch Master Nothing to the commit, Working Tree Clean it should be noted that, stash is local, not uploaded to the git server via git push command. Recommended practice to add a Message each stash, for recording the version using git stash Save substituted git stash command. Examples are as follows: $ Git stash Save "cmd-Test-stash" Working Directory State index and the Saved the On autoswitch: the Test-cmd-stash the instruction cache in the first stack stash delete, and modify the application corresponds to the current working directory. HEAD is now located in the RESET postion UNNECESSARY the Remove 296e8d4 onResume function $ git stash List stash @ {0}: the On autoswitch: the Test-cmd-stash 2. reapply cache stash can cache before pop by git stash command to restore the working directory, output as follows: $ git Status the On Branch Master Nothing to the commit, Working Tree Clean $ git stash POP the On Branch Master Changes to BE committed: new new File: the style.css Changes not staged for the commit: Modified: index.html Dropped refs / stash @ { 0} (32b3aa1d185dfe6d57b3c3cc3b32cbf3e380cc6a) Changes to BE committed: You can also use git stash apply command, the cache stack stash repeatedly applied to the working directory, but does not delete stash copies. Command output is as follows: $ git stash the Apply the On Branch Master stash @ {0}: the WIP ON Master: The index added File 049d078 File new new: the style.css Changes Not for staged for the commit: Modified: index.html 3. See stash prior use git stash list command, a typical output follows: $ git stash list stash @ {0}: the WIP ON Master: 049d078 added at the index File stash @ {1}: WIP oN Master: c264051 Revert "added FILE_SIZE" stash @ {2}: WIP oN Master: 21d80a5 added Number the to log in when using git stash apply command can specify which stash by name , stash default to the last (i.e. stash @ {0}). 4. Remove the stash can use git stash drop command may be followed stash name. Here is an example: $ Git stash List stash. 1} {@: the WIP ON Master: the Revert c264051 "added FILE_SIZE" stash @ {2}: the WIP ON Master: Number 21d80a5 added to log $ Git stash drop stash @ {0} Dropped stash @ {0} (364e91f3f268f0900bc3ee613f9f733e82aaed43 ) or use git stash clear command to delete all cached stash. 5. Review the designated stash of diff can use git stash show command may be followed stash name. Examples are as follows: $ Git stash Show index.html | +. 1 the style.css |. 3 +++ 2 Files changed, insertions. 4 (+) was added -p --patch or behind which a specific command to view all stash diff, as follows : $ git stash Show -p diff - git A / the style.css b / the style.css new new File 100644 the MODE index 0000000..d92368b --- / dev / null +++ b / the style.css @@ -0, @@ + 1, 3 0 + * { + text-Decoration: Blink; +} the diff A - Git / index.html B / index.html index 9daeafb..ebdcbd2 100644 --- A / index.html +++ B / index.html @@ @ -1 +1,2 @ + <Link rel = "stylesheet" href = "the style.css" /> 6. Create a branch from the stash if you store some work temporarily ignore, and then continue to work on a branch store your work, you reapply You may encounter some problems at work. If you try to change the application is for a modified after you file, you'll run into a conflict and must merge to resolve it. Which submitted when if you want a more convenient way to re-examine your storage changes, you can run git stash branch, which creates a new branch store checkout your work, reapply your work, if success will be discarded storage. Branch testchanges git stash $ Switched to A new new Branch "testchanges" # testchanges the On Branch # Changes to BE committed: # (use "git the RESET the HEAD <File> ..." to unstage) # # Modified: index.html # # Changes staged for the commit not: # (use "git the Add <File> ..." This is a great shortcut to restore the store and then continue to work at that time working on the new branch. 7. staging or ignore untracked files by default, git stash caches the following files: added to modify the temporary area (staged Changes) Git track but did not add to modify (unstaged changes) the temporary area but not cached at the file: new file (untracked files) in the working directory to be ignored file (ignored files) git stash command provides file caching parameters for the above two types. Use the -u or --include-untracked can stash untracked files. Use -a or --all command can stash all the changes in the current directory. As for the other command git stash of proposed reference Git manual.
git stash // save the current progress of work, the changes will save up staging area and workspace. stash the Save git 'the Message .....' git stash Show // see just the temporary modifications git stash list // see all the temporary staging area changes git stash pop // remove the last staging and delete records list corresponding recording git stash pop stash @ {1} // progress to recover for the workspace. stash_id is obtained by git stash list command git stash apply stash @ {X} // fetches the corresponding temporary recording list without deleting the corresponding record git stash drop stash @ {X} // remove the corresponding record in the list staging record delete git stash drop [stash_id] // delete the progress of a store. If you do not specify stash_id, delete the default storage latest progress git stash clear // delete all stored schedule.