$ git stash // for daily usage.25 Apr 2015
Imagine you average day, tons of task, issues, and concerns. You have to switch on and off all the time during the day. It’s a bit annoying isn’t it ?
You spend some time to figure out what’s going on on a project, add some log statements, and
console.log is logging pretty much all information what you need, but manager want’s you to take a look on a urgent hotfix.
$ git stash
Is going to help you, it works fine, but there is even more useful options. Use
-u if you want to stash unstated files too.
$ git stash -u
This command is going to clean you project tree to original state and keep all changes as well as new files in safe place.
Of course you can restor it any time by hitting
git stash apply, but if know for sure it was an experiment or just one time job, it’s better to use
git stash pop, pop work as expected and no more work for clean up you stashes required.
Last but not least things to know, you can use an awesome flag
-p with stashes as you do with
git commit. It works the same, you gonna be asked about any change in the same way.
$ git stash -p