Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.gitignore and git rm --cached wont keep files from being tracked

Tags:

git

I have an android project that has a test module that will remove and recreate .apk files in a subdirectory in the git directory.

I have added these to .gitignore (the directory, the files explicitly, and *.apk ) and then I have done

git rm -r --cached src/main/Tests/bin

and git tells me:

rm 'src/main/Tests/bin/Tests-debug-unaligned.apk'
rm 'src/main/Tests/bin/Tests-debug.apk'
rm 'src/main/Tests/bin/Tests.ap_'
rm 'src/main/Tests/bin/classes.dex'

i then

git commit . -m "removed apk files"

I run the tests again which delete the files and the recreate them. I run git status and they show up as modified. It seems .gitignore is not working. Here is my .gitignore file

*ipr
*iml
*iws
.gitignore
out/
*apk
src/main/Tests/bin
src/main/Tests/bin/*
src/main/Tests/bin/Tests-debug-unaligned.apk
like image 275
browep Avatar asked Oct 07 '11 21:10

browep


1 Answers

I think you need to clean all your stagged files using:

git rm -r --cached .

git add -A

Then commit:

git commit -m ".gitignore"

But make sure you commit your changes before doing this.

like image 168
Genjuro Avatar answered Oct 06 '22 18:10

Genjuro