git stash

I feel like stash is another commits tree, but only one node. This is used for temporarily store away your current work directory.

When you type

git pull

This will firstly check if your work directory matches your commits or your stash. If not, it will gives you some error

file foobar not up to date, cannot merge.

Then, if you git stash your current work directory, if will allow you pull

git stash
git pull
git stash pop

git stash pop throws away the (topmost, by default) stash after applying it, whereas git stash apply leaves it in the stash list for possible later reuse (or you can then git stash drop it).

Leave a Reply

Your email address will not be published. Required fields are marked *