[英]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.