2017-07-07 142 views
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失踪,以及一周的工作。 :-(

我有两个问题:?

  1. 有没有什么办法让我的文件后,我怀疑,答案是“不”

  2. 这是一个错误,或者没有。我做错了什么?

我见过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 

回答

0

我测试了我用git的next分支(v2.14.0.rc0)摄制例子,这个问题并没有提出本身,所以我想这是一个错误,并且有人已经提交了一个修复程序。