21

I'm looking for to exclude a file form versioning. I see the "add" to vcs button on a file but i doesn't find the "untrack" or "ignore" button like in eclipse.I tried to exclude folder .idea/. I tired to edit gitignore manualy and the ignore file button but nothing works. Any ideas ?

Thanks thomas

thelittlefireman
  • 211
  • 1
  • 2
  • 6

1 Answers1

44

You can remove tracked files from vcs manually using "Terminal" tab in Android Studio or Git Bash console.

To untrack ignored files you should:

1) Make sure the files you want to ignore are properly listed in .gitignore

2) Commit pending changes (important!)

3) Execute commands

git rm -r --cached . 
git add .

4) And then commit again:

git commit -am "Remove ignored files"

These steps will remove all the items from Git Index and then update it again, while respecting git ignores.

The reason for commiting pending changes at step 2 is that if the rm is part of another commit it doesn't work as expected.

Check more information in comments here.

Community
  • 1
  • 1
Artem M
  • 1,026
  • 14
  • 24