2017-06-15 129 views
0

所以我見過幾個和我的類似的帖子,但是他們的答案似乎都不適用於我。忽略除了某些子目錄及其內容以外的所有內容

我有一個文件夾結構有點像以下:

|-- identity 
| |-- custom 
| | |-- pages 
| | `-- static 
| |-- lib 
| | `-- ext 
| |-- logs 
| `-- webapps 
|-- oxauth 
| |-- custom 
| | |-- pages 
| | `-- static 
| |  `-- img 
| |-- lib 
| | `-- ext 
| |-- logs 
| `-- webapps 
`-- oxauth-rp 
    |-- logs 
    `-- webapps 

我想忽略除custom文件夾和它們的內容應有盡有。

我曾嘗試以下忽略文件:

* 
!.gitignore 
!/custom/ 

* 
!.gitignore 
!/identity/custom/ 
!/oxauth/custom/ 

但是卻忽略了一切,除了我的根的.gitignore文件。

至少這就是我運行git狀態時所說的。並且在自定義/頁面文件夾下有文件。 那麼,我錯過了什麼?

+0

是否存在所有目錄(或其子目錄)內的文件,您希望將其包含'的lib/ext'? Git不包括空目錄 –

+0

是的,我知道git不包括空目錄。我想包含的目錄中有文件。 'lib/ext'是我不想要的文件夾之一。我只想包含自定義文件夾 – munHunger

回答

2

根據我的測試,以下應該達到預期的效果。

* 
!*/ 
!.gitignore 
!/oxauth/custom/** 
!/identity/custom/** 
+0

解決了它。你是最棒的! :) – munHunger

相關問題