标准写法1 以及忽略文件语法
https://www.cnblogs.com/hyfx-learn-forever/p/4757814.html
标准写法2
https://blog.csdn.net/myatlantis/article/details/50313479
.gitignore不生效?
https://www.jianshu.com/p/76b4b99762ef
第一步(已经存在了 可以跳过第一步)
touch .gitignore
生成.gitignore忽略配置文件

第二步 打开android studio
会看到两个.gitignore文件
一个是app下的,一个是项目的

app下的.gitignore文件需要两行内容就可以了:

重点关注项目下的.gitignore文件
第三步 修改项目下的.gitignore文件为以下内容 也可以自己添加
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Others
.idea/
*.iml
第四步 已经提交过代码 再修改.gitignore不生效?
#先删除本地仓库缓存再添加并提交,注意中间包含空格
git rm -r --cached .
git add .
git commit -m "配置忽略文件"
git push origin ...
网友评论