You are here
Use the stash, Luke (git-stash)
Alon Swartz - Mon, 2011/06/06 - 12:22 -
5 comments
I was in the middle of developing a new feature for the TurnKey Hub when I received a bug report that needed to be fixed.
What to do? Throw away my current changes? Checkout a clean branch? Of course not! Just stash my changes away, fix the bug, and get my changes back so I can continue development.
It's so simple and useful, I thought I'd share my notes in case others don't know about git-stash.
git-status # we have a bunch of uncommitted changes git-stash # stashes away changes, reverts working copy to HEAD git-status # no uncommitted changes ... fix the bug git-stash list # see what we have stashed away git-stash pop # apply uncommitted changes back to working copy
The above makes simple use of the Git stash, but there is lots more you can do with it. Also remember that the stash acts like a stack which means you can store multiple stashes.
Comments
git-xxx
Hi Alon,
Git has this wonderful ability to look for commands in your path named git-* and let you run them as "git *" instead. For instance, I use the "Git Extras" at git://github.com/visionmedia/git-extras.git [see https://github.com/visionmedia/git-extras#readme for documentation] and since they're in my path, they just work.
I just wanted to say that when you are showing example git commands, generally you would say "git stash" rather than "git-stash".
Reid
git stash
Juan, instead of temporary comit + reset HEAD^, I just use stash.
Doesn't that make sense?
Pages
Add new comment