一共三步:
1、切换到需要忽略的目录下,一般可以在项目根目录,与App moudle同级
2、运行下方命令生成gitignore文件
touch .gitignore
3、配置忽略,通用的Android忽略如下
# 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/
app/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/
4、如果没有生效,可能是因为之前就已经被存入了缓冲区,按以下步骤清理git缓冲区,并重新提交:
git rm -r --cached .
git add .
git commit -m "update .ignore"
网友评论