Sunday, 28 September 2014

Git ignores my folder - here is a solution (for me it was : git ignored my drawable-xxxx folder with files)

I am not good in writing long posts so.. here is a short example and solution for that problem.
Be sure you have already checked .gitignore files, and you are sure it is not .gitignore files problem.

First, please write this code in console - to get list of ignored files:

 git status --ignored  

 # On branch master  
 # Ignored files:  
 #  (use "git add -f <file>..." to include in what will be committed)  
 #  
 #    ../../../.gradle/  
 #    ../../../.idea/  
 #    ../../app.iml  
 #    ../../build/  
 #    res/drawable-hdpi/  
 #    res/drawable-ldpi/  
 #    res/drawable-mdpi/  
 #    res/drawable-xhdpi/  
 #    res/drawable-xxhdpi/  
 #    res/drawable-xxxhdpi/  
 #    ../../../build/  
 #    ../../../java_pid5188.hprof  
 #    ../../../java_pid5940.hprof  
 #    ../../../local.properties  
 #    ../../../prawo-g.iml  

As you see, somehow res/drawable-xxxx is ignored..
So let's add it again by this command:

 git add --force .\res  

And let's see again our ignore list...

 git status --ignored  


 # On branch master  
 # Ignored files:  
 #  (use "git add -f <file>..." to inclu  
 #  
 #    ../../../.gradle/  
 #    ../../../.idea/  
 #    ../../app.iml  
 #    ../../build/  
 #    ../../../build/  
 #    ../../../java_pid5188.hprof  
 #    ../../../java_pid5940.hprof  
 #    ../../../local.properties  
 #    ../../../prawo-g.iml  

Voila! Our missing files were added back to revision.
Dont forget to use later commands:

 git add -A   
 git commit -am "added missing files in revision"