To stash changes not ready to commit, for instance when you want to switch branch. Can be seen as a quick store which can be restored to any branch not just the one you stashed from.
[store changes that are tracked or staged]
git stash
[store all changes including untracked files]
git stash -u
[store with a message to identify changes made]
git stash save <stash-message>
[view all stashes]
git stash list
[show files in last stash]
git stash show
[show changes in last stash]
git stash show -p
[example: show changes in specified stash]
git stash show -p stash@{1}
[re-apply changes in most recent stash to any branch you are on keeping the stash]
git stash apply
[re-apply changes of specific stash to any branch you are on keeping the stash ]
git stash apply <stash-id>
[example: git stash apply stash@{2}
OR git stash apply 2
]
[re-apply changes in most recent stash to any branch you are on deleting the stash]
git stash pop
[re-apply changes of specific stash to any branch you are on deleting the stash ]
git stash pop <stash-id>
[example: git stash pop stash@{2}
OR git stash pop 2
]
[to undo apply]
git checkout -f
https://stackoverflow.com/questions/10725729/see-whats-in-a-stash-without-applying-it