2016-12-22 56 views
-1

我試圖刪除「js」文件夾中的所有文件被跟蹤。從跟蹤排除與.gitignore不工作

這裏是我的.gitignore:

# See http://help.github.com/ignore-files/ for more about ignoring files. 

# compiled output 
/dist 
/tmp 


# dependencies 

# IDEs and editors 
/.idea 

# misc 
/.sass-cache 
/connect.lock 
/coverage/* 
/libpeerconnection.log 
npm-debug.log 
testem.log 
/typings 

# e2e 
/e2e/*.js 
/e2e/*.map 

# js 
js/ 


#System Files 
.DS_Store 

node_modules/ 
bower_components/ 
.sass-cache/ 
images/ 
app/test/reportscreenshots/ 
app/test/report/ 

注意js/它不是從被跟蹤刪除該文件夾中的文件。這裏是我的文件夾結構:

enter image description here

爲什麼我的.gitignore沒有被跟蹤排除「JS」文件夾中的文件?

+1

您以前是否將該JS文件夾添加到您的存儲庫?如果是這樣,那麼你需要使用'git rm --cached',然後才能忽略它。 –

+0

試試'git rm --cached js/**/*。js' –

回答

0

如果之前已經跟蹤過該文件夾,那麼將它添加到.gitignore中將不會對其進行跟蹤。

您還需要從您的git回購刪除的文件/目錄

git rm --cached -r mydirectory

--cached將從gitrepo從服務器上刪除,但不是。從this StackOverflow question

之後,如果您git status,您將在狀態中看到已刪除的文件夾。您將需要提交您的刪除。