[英]git .gitignore not ignoring previously tracked files
我有一个Android Studio项目(从Eclipse导入)。 在导入到Andorid studio后,我做了一次初次提交,却忘记为Android Studio的结构添加新的.gitignore文件。
现在git不会忽略构建,.gradle文件等。
我尝试了
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
技巧,但是当我写git status时,所有文件都显示为已删除,而在github中它们显示为已更改。
以下是我的.gitignore
.gradle
/local.properties
/.idea/workspace.xml
.DS_Store
# Created by http://gitignore.io
### Android ###
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Eclipse project files
.classpath
.project
# Proguard folder generated by Eclipse
proguard/
# Proguard folder generated by Intellij
proguard_logs/
# Intellij project files
*.iml
*.ipr
*.iws
.idea/
adt-bundle-windows-x86_64/
### Linux ###
.*
!.gitignore
!.git*
*~
### IntelliJ ###
*.iml
*.ipr
*.iws
.idea/
### Gradle ###
# Exclude Folder List #
.gradle/
build/
/*/out
/*/*/build
/*/*/production
*.iws
*.ipr
*~
*.swp
我仍然可以在build和.gradle文件夹中看到所有文件。
有什么建议么?
git clean -xf
删除所有与.gitignore匹配的文件。
git rm --cached "xxx"
git commit -m ""
git reset HEAD -- "xxx"
git commit -m ""
(更新仓库) 也许,您需要使用以下语法:
**/build
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.