AS自带的.ignore文件
在AS中新建项目时,默认会创建一个.ignore文件,其中默认忽略的是
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
但是用起来不是十分方便,所以再介绍一个自动忽略的插件,并且可以多增加一些忽略的文件
.ignore插件介绍
简介
.ignore is a plugin for .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), .flooignore (Floobits), .eslintignore (ESLint), .cfignore (Cloud Foundry), .jpmignore (Jetpack), .stylelintignore (StyleLint) files in your project.
Features
- Files syntax语法 highlight
- Coloring着色 ignored files in the Project View(忽略文件在AS中显示为灰色)
- Gitignore templates模板 filtering过滤 and selecting in rules generator by name and content
- Show ignored files by specified指定的 ignore file (right click on .gitignore file)
- Create file in currently selected directory
- Generate Gitignore rules basing on GitHub's templates collection
- Add selected file/directory to ignore rules from popup menu
- Suggesting .gitignore file creation for new project
- Entries inspection (duplicated, covered, unused, relative, incorrect syntax, relative entries) with fix actions
- Comments and brackets support
- Navigation to entries in Project view
- Renaming entries from ignore file
- Close opened ignored files action
- Custom user templates with import/export features
- Create custom templates from existing rules
- Favorite templates
.ignore插件使用
1、新建
File菜单或工程上右键-->New-->最下面的.ignore file-->选择.gitignore file
2、添加忽略文件
上述新建时,或在AS项目中的.gitignore文件上右键时,选择Add template
生成
3、自动忽略的规则 如下:
### Android template
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/libraries
# Keystore files
*.jks
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
最好先将里面的内容拷出来