Stashing away your changes
Often, when you've been working on a project, and things are in a messy state not suitable for a permanent conflict, you want to temporarily save the current state and go to work on something else. The answer to this problem is the
git stash command.
Stashing takes the dirty state of your working area—that is, your modified tracked files in your worktree (though you can also stash untracked files with the
--include-untracked option), and the state of the staging area, then saves this state, and resets both the working directory and the index to the last committed version (to match the
HEAD commit), effectively running
git reset --hard HEAD. You can then reapply the stashed changes at any time.
Stashes are saved on a stack: ...