現象
- 
git stash -uとした時に特定のファイルが消滅
- 
git stash popとしても復元されない
状況
git管理下の以下の構造
.
├── foo.txt
└── hoge
    └── bar.txt
.gitignoreの中身
hoge/*
この状態で一度コミット
git add .
git commit -m 'first commit'
操作
foo.txtを適当に編集して差分を発生させる。
上記の状態でgit stash -uを実行すると
.
└── foo.txt
となり、hoge以下のignoreしているものまで消えてしまう。
しかもgit stash popしても復元されない。
一連のコマンド履歴
git init
touch foo.txt
mkdir hoge
touch hoge/bar.txt
echo 'hoge/*' > .gitignore
git add .
git commit -m 'first commit'
echo 'diff text' > foo.txt
git stash -u
tree
git stash show
git stash pop
tree
原因
恐らく.gitignore内の記述の問題かと思われる。
.gitignoreをhoge/*ではなくhoge/に書き換えて、他の状態は同じでgit stash -uをすると
hogeディレクトリが消えずに残る。
バグなのか仕様なのか分からないが、git管理外のものがgitの操作で消えるという悲惨な目に合った。
みなさんも.gitignoreとgit stash -uには気をつけましょう。

