のは、私は、このディレクトリ構造を持っているとしましょう:兄弟ディレクトリ
project_root | +--parent | +--child | +--baby_brother
baby_brother
はgitのことで追跡されていない、新しいディレクトリです。私はchild
のファイルに多くの変更を加えました。私はchild
内のファイルの以前のバージョンへの一時的なアクセスを必要とするので、私は、私はちょうど私の変更を隠したい考え出し:
cd $project_root/parent/child
git stash push .
その後、後:
私の落胆にずっと今cd $project_root/parent/child
git stash pop
、baby_brother
1週間分の作業と一緒に行方不明になっています。 :-(
私は2つの質問があります。
は戻って私のファイルを取得する方法はあります、私は答えは「ノー」である疑いがある
これはバグですか、やりました?。私が何かを間違っていますか?私はそれが人跡未踏のファイルを削除するにはgitのための行動を期待していますが、1のために、それはまた、私は2.13を使用しています(これは1.7.1.1で修正されたと言う言うan SO questionを見てきました
。 0)、私はそのディレクトリにいて、現在のディレクトリを参照するコマンドの最後にドットが含まれていたので、2人のために、私は隠しがchild
に影響することを期待しました。ここで
は、問題を示し、迅速REPROです:
1 ~ % mkdir project_root 2 ~ % cd project_root 3 project_root % mkdir parent 4 project_root % touch parent/file 5 project_root % mkdir parent/child 6 project_root % touch parent/child/file2 7 project_root % git init Initialized empty Git repository in /home/pdaddy/project_root/.git/ 8 project_root % git add . 9 project_root % git commit -m 'Get it in git' [master (root-commit) 2d0872c] Get it in git 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 parent/child/file2 create mode 100644 parent/file 10 project_root % mkdir parent/baby_brother 11 project_root % touch parent/baby_brother/file3 12 project_root % touch parent/file4 13 project_root % touch file5 14 project_root % comment="As it turns out, file4 and file5 will be deleted, too." 15 project_root % tree $PWD /home/pdaddy/project_root |-- file5 `-- parent |-- baby_brother | `-- file3 |-- child | `-- file2 |-- file `-- file4 3 directories, 3 files 16 project_root % echo 'some changes' >> parent/child/file2 17 project_root % cd parent/child 18 child % git stash push . Saved working directory and index state WIP on master: 2d0872c Get it in git 19 project_root % tree ~/project_root /home/pdaddy/project_root `-- parent |-- child | `-- file2 `-- file 2 directories, 2 files 20 child % git stash pop On branch master Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: file2 no changes added to commit (use "git add" and/or "git commit -a") Dropped refs/[email protected]{0} (80e41d0ed1f2b0a085d4f5ca3a38833a18873f98) 21 child % tree ~/project_root /home/pdaddy/project_root `-- parent |-- child | `-- file2 `-- file 2 directories, 2 files