What happened to my gitignore?

What is wrong with my .gitignore file?

 build/ /build /*/build/ /*/*/build/ build/ 

This is the structure of my directory:

 myroot FacebookSDK +--src +--build +--foo +-- bar app +--scr +--build build +--other stuff... +--other stuff.. .gitignore other stuff... 

The problem is that foo and bar are not ignored!

What could be wrong?

 xxxxs-my:xxxx xxx$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: FacebookSDK/FacebookSDK.iml modified: FacebookSDK/build.gradle modified: FacebookSDK/build/intermediates/bundles/debug/classes.jar modified: FacebookSDK/build/intermediates/bundles/debug/res/drawable/com_facebook_button_blue.xml 
+4
source share
3 answers

You only need this rule in the documentation :

 **/build 

This excludes the global build folders.

If any of these folders has been added before, you will have to remove it from Git via git rm .

What is really wrong with your .gitignore :

  • /build and build/ equivalent; they will correspond to the build/ top-level folder.
  • /*/build and /*/*/build will not match anything.
+4
source

I believe because three lines are ignored from the root directory:

 /build /*/build/ /*/*/build/ 

when they should be from the current directory:

 ./build ./*/build/ ./*/*/build/ 
0
source

try using

 build/ **/build/ 

in .gitignore

If the files are already being monitored, use git rm --cached myfile to remove them from version control, but save them in a local repo. Once removed from version control, they should not be detected upon change.

0
source

All Articles