在根目錄中新建.gitignore文件,設(shè)置如下:
.idea
log/
target/
*.iml
若沒有生效,是因?yàn)間itignore只能忽略那些原來沒有被 track 的文件,如果某些文件已經(jīng)被納入了版本管理中,則修改 .gitignore 是無效的。
解決方法是先把本地緩存刪除,然后再提交。
git rm -r --cached .
git add .
git commit -m "update .gitignore"
git push -u origin master