Git:Stash
lastmod 2015-03-20created 2014-03-049 edits
Backs up unstaged files in the working directory and returns the working directory to a clean state, i.e. the state of HEAD
Frequently used Git Stash command options
-
git stash save - Saves the current work and restores to HEAD.
-
git stash list - Shows the list of saved stashes.
-
git stash pop - Takes out and applies the most recently saved stash.
-
git stash apply - Same as stash pop, but does not delete it from the list.
-
git stash clear - Deletes all stashes.
-
git stash drop - Deletes an unneeded stash.
Example
A summary of how to use the Stash command.
Checking another Branch
- Check the Branch you are currently working on:
git branch
(assume the master branch) - Save the current work:
git stash save - Move to another Branch:
git checkout 93fd64b - Check the Branch.
- Check the log and status:
git log --oneline --decorate --graph --all
- Check the log and status:
- After checking, move back to the Branch you were working on:
git checkout master - Restore the previous work:
git stash pop
Pages that link here