2011-05-21 117 views
0

我有這樣的.gitignore文件:爲什麼Git的繼續忽略子

# Ignore wordpress 
/wordpress/ 
/wordpress/* 

# Except the wp-content folder 
!/wordpress/wp-content/ 
!/wordpress/wp-content/* 

但是,當我改變的wp-content東西的變化沒有被git的身份上市,而如果我做

git add wordpress/wp-content 

我仍然收到警告.gitignore包含/ wordpress /,因此不會添加更改。爲什麼是這樣?

aditional的

我在OSX,運行git 1.7.3.2

回答

3

我不相信你想因爲有在wordpress目錄中的某些東西,忽略了wordpress目錄本身你確實想跟蹤。您只需要忽略wordpress目錄中頂級路徑的大多數

這個.gitignore應該足夠了。

# ignore most things in the wordpress directory 
/wordpress/* 

# ... except the wp-content directory 
!/wordpress/wp-content/ 
+0

Oooh,當然。我沒有區分忽略文件夾和忽略文件夾的內容,但沒有文件夾本身。這工作,謝謝! – 2011-05-21 12:15:56