Stash your changes away.

Stash saves your local modifications and reverts the working directory to match the HEAD commit.

git stash save "wonderful changes"

 


git stash apply "wonderful changes"

 

git stash apply stash^{/wonderful} <- keeps the stash in the list

git stash pop       <- removes the stash from the list


List all stashes

 

git stash list


Typical work flow

git pull

...

file foobar not up to date, cannot merge

git stash 

git pull

git stash pop


Note: 

stash only applies to added files.

does not apply to untrackd files

 

{0} the last stash you did

{1} the second last stash you did

git show stash@{0}

 

Git stashes are stored as commit objects, but HEAD isnt update to point to them.

They are referenced from a reflog entry in .git/logs/refs