threads / bug / 35103

[BUG] git stash doesn't use --index as default

Subject: [BUG] git stash doesn't use --index as default

## tl;dr

One message between Oct 11, 2013 and Oct 11, 2013.

replies: 0people: 1as markdown or json

James· Oct 11, 2013, 04:57 UTC · lore
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.

← back to recent threads