1

This is my .gitignore (.gradle/ in the 17th line):

# Built application files
*.apk
*.aar
*.ap_
*.aab
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
#  Uncomment the following line in case you need and you don't have the release build type files in your app
# release/
# Gradle files
.gradle/
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/
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/gradle.xml
# .idea/assetWizardSettings.xml
# .idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
*.jks
*.keystore
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/
# Google Services (e.g. APIs or Firebase)
google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
# Version control
vcs.xml
# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
# MacOS
.DS_Store
# App Specific cases 
app/release/output.json
.idea/codeStyles/
# Android Profiling
*.hprof

Yet, when I view the list of unstaged changes, I see there some files under the .gradle/ folder:

Unstaged Changes via Git Gui

Why aren't these files ignored like other .gradle files?

WebViewer
  • 761
  • 7
  • 21
  • 3
    If they were already committed before adding the `.gitignore` you'll need to untrack them. Does https://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository help? – nullforce Jan 12 '23 at 07:03
  • 1.) delete .gradle folder 2.) commit changes 3.) .gradle should be ignored now – howardButcher Jan 12 '23 at 07:12
  • @nullforce Indeed they were already committed in the Initial commit, when my .gitignore was still empty. The https://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository instructions worked perfectly for me. Please post your comment as an answer so that I can accept it. – WebViewer Jan 12 '23 at 07:52

1 Answers1

1

If they were already committed before adding the .gitignore you'll need to untrack them. Does Ignore files that have already been committed to a Git repository help?

nullforce
  • 1,051
  • 1
  • 8
  • 13
  • Yes, it certainly helps. Specifically, running the following 3 commands in sequence (after verifying that desired changes are committed/saved): 1. `git rm -r --cached .` 2. `git add .` 3. `git commit -m ".gitignore is now working"` – WebViewer Feb 10 '23 at 09:46