

Git tricks: stash - srl
http://bytbox.net/blog/2012/07/git-stash.html

======
loganfsmyth
I definitely agree that stash is useful, but I'm more of a fan of committing
early and often, then squashing using git rebase -i.

------
woadwarrior01
I used to use stash before discovering Kenneth Reitz's legit (
<http://www.git-legit.org/> ). With legit, git switch <branchname>
automatically stashes and restores uncommitted changes before and after
switching branches. One less command to type and sightly higher level.

------
Myrmornis
> Sometimes, something needs fixing ASAP, and you have 260 build-breaking
> lines an hour away from being commit-worthy

If you have 260 lines of code you should have committed it already. I disagree
with the article. stash is the wrong solution for a substantial set of changes
tied to a particular branch -- instead you should use a temporary branch, and
relax about using git reset to rework it later.

> clone a new copy of the repository

The thought shouldn't even be entering your mind.

------
PuercoPop
If you want to make a quick fix it in an unrelated function or the same file
would be easier to do git add -p <file>. It allows to decide which change to
stage.

~~~
srl
Yup. It's often hard to test that change if the rest of the working copy is
borked, though.

~~~
sofal
"git stash --keep-index" to stash everything except for what is in the index,
or "git stash -p" to choose what changes to stash.

------
ernestipark
I find stash to be most useful when you want to pull in changes but have a
dirty directory.

