I recently added .gitignore to the project, in order to make it work, I used git rm --cached
to remove redundant files, but when I checked with git status
, I found that these files are actually untracked, I want to know why they are untracked files and not tracked files.
--Update--
I know these files should not be added to git, maybe I am not clear, because I added gitignore later, so I want to remove git's control of these files now, but after removal they become untracked , but some files are staged and marked as delete, so I just wonder why only these files become untracked after I use git rm --cached
.
.gitignore
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Log/OS Files
*.log
# Android Studio generated files and folders
app/build/
app/release/
captures/
.externalNativeBuild/
.cxx/
*.apk
output.json
# IntelliJ
*.iml
.idea/
misc.xml
deploymentTargetDropDown.xml
render.experimental.xml
# Keystore files
*.jks
*.keystore
# Google Services (e.g. APIs or Firebase)
google-services.json
# Android Profiling
*.hprof
CodePudding user response:
Any folder with generated content should not be versioned.
If you edit your .gitignore
and add rules like github/gitignore/Android.gitignore
, those untracked files should becomes "ignored".
That means there should not be listed anymore in your git status
.
In the chat, the OP confirms having environment variables starting with GIT_
.
If those are "repository location" GIT_DIR
or GIT_WORK_TREE
, that would explain why the .gitignore
appears to be not working.
The git status would be executed actually against another repository location, even when done in the folder with said .gitignore
.