一、在.gitignore文件中還能夠使用wildcard(某位同窗稱之爲「野卡」 哈哈)通配符,例如,*.log,去掉.gitignore同一文件夾中的全部後綴名爲log的文件。GitHub上提供了一份經常使用的忽略規則,你們能夠拿來參考,詳見此處:https://gist.github.com/octoc...。node
二、若是.gitignore忽略規則建立於文件提交代碼庫以後,則.gitignore規則不會影響目前所提交的文件(不會自動把文件從服務器端刪除掉)。你須要手動刪除,用以下的方式:git
git rm --cached <FILENAME> -f
<FILENAME>即你要移除的文件全名。git rm --cached <DIR> -r
<DIR> 你要刪除的文件夾github
.gitignore 文件示例:
*.iml
.idea
.ipr
.iws
*.diff
*.patch
*.bak
.DS_Store
node_modules/
node_modules2/
.project
.settings
npm-debug.log
.*proj
.svn/
*.swp
*.swo
*.log
examples/dist/
yarn-error.log
test/unit/coverage
.vscodenpm