Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android studio delete file from vcs

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

like image 754
thelittlefireman Avatar asked Feb 04 '15 23:02

thelittlefireman


People also ask

How do I Turn Off VCs in Android Studio?

Android Studio > Preferences... In the Preferences window, select Version Control and under Directory choose VCS dropdown to be <none> Don't forget to click "Apply" in the general Preferences buttons at the bottom.

How to remove tracked and Ignored files from VCs?

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!)

How do I remove Android Studio from a folder?

In this directory delete .android, .AndroidStudio and any analogous directories with versions on the end, i.e. AndroidStudio1.2, as well as .gradle and .m2 if they exist. Then go to %APPDATA% and delete the JetBrains folder. After deleting all these folders, go to C:\Program Files and delete the Android folder.

How to add unversioned files in Android Studio?

In the console, we would use the git add command. But we can do this right from within Android Studio. Select the Unversioned Files drop-down in the Local Changes tab, right-click and go to Git > Add or use Control-Alt-A. Remember that selecting the root folder will add everything inside it to the staging area.


1 Answers

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.

like image 105
Artem M Avatar answered Sep 24 '22 05:09

Artem M