I am using smartgit on windows.
I am trying to add some directories in the repo to be ignored.
I am using the following .gitignore, that was recommended for Android Studio android application.
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
build/
# Local configuration file (sdk path, etc)
local.properties
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
.classpath
.project
# Android Studio
*.iml
.idea
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
.gradle
build/
#NDK
obj/
To my understanding, the Build folder should be ignored, but it is not being ignored. In addition the Build\Generated folder is being ignored, but that dir is not even added to the gitignore file.
Here you can see the build folder is not ignored yet the generated folder is.
With this
build/
you're telling git to skip the build
directory entirely, so it will automatically ignore any files or directory in that path.
So the generated
directory is correctly being ignored.
Now, the only reason (given your gitignore) for intermediate
to be included, is that it was already committed on the repo before it became ignored.
If you want to start ignoring it, you need to remove it first, using
git rm -r --cached build/intermediate
As a bonus, if you want to ignore a directory, but not a subdirectory you can do
build/*
!generated
Here's a more thorough explanation on the subject: .gitignore exclude folder but include specific subfolder