0
的git的藏匿後失去了兄弟目錄比方說,我有這樣的目錄結構:當前目錄
project_root | +--parent | +--child | +--baby_brother
baby_brother
是一個新的目錄,由混帳未經跟蹤。我還對child
中的文件進行了很多更改。我需要在child
文件的以前版本的臨時訪問,所以我想我只是藏我的變化:
cd $project_root/parent/child
git stash push .
再後來:
cd $project_root/parent/child
git stash pop
現在,令我失望的是,baby_brother
失蹤,以及一週的工作。 :-(
我有兩個問題:?
有沒有什麼辦法讓我的文件後,我懷疑,答案是「不」
這是一個錯誤,或者沒有。我做錯了什麼?
我見過an SO question是說,它預計混帳刪除未跟蹤文件的行爲,但對於一個,它也說,這是固定的1.7.1.1(我使用的是2.13。 0),並且對於兩個,我預計存儲只會影響child
,因爲我在該目錄中並在命令末尾包含一個點以引用當前目錄。
這裏是一個快速的攝製演示該問題:
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