Subject: git stash data loss

From: Aleksandr Pryimak <[email-masked]>
Date: Fri, 27 Jul 2012 07:06:08 +0400

Hello.

It is believed that
git stash
git stash pop
is safe to-do operation. But sometimes it is not. For example here is an example http://stackoverflow.com/questions/11680453/git-stash-where-did-the-files-in-my-directory-go/11680645

I also recreated it

aleksandr@beast:/tmp/test$ git init
Initialized empty Git repository in /tmp/test/.git/
aleksandr@beast:/tmp/test$ touch x
aleksandr@beast:/tmp/test$ git add x
aleksandr@beast:/tmp/test$ git commit -m "Initial"
[master (root-commit) d3569a0] Initial
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 x
aleksandr@beast:/tmp/test$ rm x
aleksandr@beast:/tmp/test$ mkdir x/
aleksandr@beast:/tmp/test$ ls
x
aleksandr@beast:/tmp/test$ git stash
Saved working directory and index state WIP on master: d3569a0 Initial
HEAD is now at d3569a0 Initial
aleksandr@beast:/tmp/test$ ls
x
aleksandr@beast:/tmp/test$ git stash pop
Removing x
# On branch master
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	deleted:    x
#
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (c500443ae16cf0d846b195cb97eb388dec5f440e)
aleksandr@beast:/tmp/test$ ls
aleksandr@beast:/tmp/test$ git --version
git version 1.7.5.4

--
Aleksandr Pryimak