[BUG] git stash doesn't use --index as default
- From
James <purpleidea@gmail.com>
- Date
- Oct 11, 2013, 04:57 UTC
- Message-ID
- <1381467430.4130.38.camel@freed.purpleidea.com>
As discussed on #git irc:
git init vim file1 vim file2 git add file1 git add file2 git commit -m 'foo' vim file1 vim file2 vim file3 vim file4 git add -p file1 # add part of file1, use 'e' to change code too. git add file2 # add all of file2 git add file3 git stash # do a stash
hack hack hack git add, commit.
git stash apply # whoa! all my changes to index are gone!
fail fail... :( sad sad.
git reset HEAD git stash apply --index
# phew, there are my changes. git stash apply --index # the --index should be the default!
# WORSE: if you: git stash pop then DATA LOSS. (because you forgot the --index)
Made this super clear. #git agrees this is a bug, if only a UI default bug. Pretty serious though.
Cheers,
James
PS: please cc me on replies, as I'm not subscribed to list.