Re: making "git stash" safer to use
- From
- Joachim B Haga <cjhaga@fys.uio.no>
- Date
- Oct 4, 2007, 08:40 UTC
- Message-ID
- <858x6jff2v.fsf@lupus.ig3.net>
- In-Reply-To
- <200710032331.41385.bruno@clisp.org>
Show 9 quoted lines
> Through a simple typo I lost modifications to 20 files: > >> >>> $ git stash >> >>> $ git pull >> >>> $ git stash apply >> >>> $ git stash clean # typo! >> >>> $ git stash clear # fatal correction to typo! > > It is just too easy to lose your modifications by using "git stash".
What makes it most dangerous is that there is no differentiation between a name and a command in the same position. I'd argue that either the command should be mandatory:
git stash save mywork git stash apply mywork git stash clear mywork git stash mywork # error
(we can still keep today's shortcuts "git stash" and "git stash apply", but only for the un-named case),
or that the command should be of the option type:
git stash mywork git stash --apply mywork git stash --clear mywork
-j.