在IDEA中.ignore外掛的安裝與使用
.ignore簡介
.ignore是IDEA的一款專用忽略檔案的外掛。其支援的忽略檔案型別有:.gitignore (Git), .hgignore (Mercurial), .npmignore (NPM), .dockerignore (Docker), .chefignore (Chef), .cvsignore (CVS), .bzrignore (Bazaar), .boringignore (Darcs), .mtn-ignore (Monotone), ignore-glob (Fossil), .jshintignore (JSHint), .tfignore (Team Foundation), .p4ignore (Perforce), .prettierignore (Prettier), .flooignore (Floobits), .eslintignore (ESLint), .cfignore (Cloud Foundry), .jpmignore (Jetpack), .stylelintignore (StyleLint), .stylintignore (Stylint), .swagger-codegen-ignore (Swagger Codegen), .helmignore (Kubernetes Helm), .upignore (Up), .prettierignore (Prettier), .ebignore (ElasticBeanstalk)
.ignore的安裝
.ignore外掛的安裝非常簡單,如下圖所示:
.ignore的使用
這裡以我在專案中的應用為例,我的專案結構如下:
在這裡,由於我使用的是Git,因而我要在Git的提交檔案中忽略掉IDEA的相關配置檔案,所以說我們應該如下圖所示進行選擇。
在開啟的面板中,執行如下圖所示的選擇:
其預設生成的內容如下,在這裡,其已經將IDEA的配置檔案給忽略掉了。
# Created by .ignore support plugin (hsz.mobi) ### Example user template template ### Example user template # IntelliJ project files .idea *.iml out gen
如果我們想要忽略掉其它檔案,比如說在Maven專案中的target資料夾,我們可以在該資料夾下滑鼠右擊,然後手動新增忽略檔案。
其最終生成的.gitignore忽略檔案原始碼如下:
**/target
**/*.iml
.idea/
### Example user template template
### Example user template
# IntelliJ project files
.idea
*.iml
out
gen
之後我們再在命令列中使用git指令時,.gitignore檔案中配置的相關忽略檔案就不會被提交到Git中了。