Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove some files from commit checklist Android Studio?

I would like to commit changes which I did in my AS project. But I see that changeslist contains release folder:

enter image description here

It means that I will commit workable apk file and some config files which were generated during building installer. I can also untick these files but when I will try to make commit at the next time I will see these files again. Maybe I can remove these files totally from my changes list and prevent its appearing at all next times. I think it happens because I tried some commands at the terminal and one command can add these files, I think it was:

git commit --am

So, how I can solve this problem without damaging all project?

UPDATE:

Can I solve my problem with the command:

git rm --app-release.apk ?

like image 461
Andrew Avatar asked Jul 19 '19 05:07

Andrew


3 Answers

First Things first:

You can add a .gitignore file to your repository, via terminal, by the commands below:

  1. In Terminal, navigate to the location of your Git repository.
  2. Enter touch .gitignore to create a .gitignore file.

Second, you should pay attention that, If you already have a file checked in and you want to ignore it, Git will not ignore the file if you add a rule later. In those cases, you must untrack the file first, by running the following command in your terminal:

$ git rm --cached FILENAME

for more information on this follow https://help.github.com/en/articles/ignoring-files

like image 147
elyar abad Avatar answered Oct 20 '22 18:10

elyar abad


you need to add those files in your ignored files under version control area in your android studio. For navigation go to

Open File -> Settings -> Version Control -> Ignored Files. 

Add files those you don't want to commit or include. Another way of doing it like the other answer suggested to do it with .gradle tools.

enter image description here

like image 34
Umair Avatar answered Oct 20 '22 17:10

Umair


I'd recommend using https://www.gitignore.io/ for generating .gitignore file for your android project and put it in your root folder of the project.

https://www.gitignore.io/api/android gives a headstart for your android project(Modify this according to your requirement. But for most cases this should be out-of-the-box solution).

Also, to add to the point. This is expected behaviour of git and not related anyway to android studio/android.

like image 33
Mohamed Anees A Avatar answered Oct 20 '22 17:10

Mohamed Anees A