Aiman Alyosofi
Aiman Alyosofi

Reputation: 645

How to disable Git-commit with specific packages and files inside AndroidStudio?

The Problem

I had a lot of files autogenerated by Android studio after I build the project, so when I try to commit the project, the commit section is full of files I didn't want to commit or push to the repo.

enter image description here

How I can tell Git to don't care about these files and didn't commit or push them?

What I try

I try to add the packages dir in the .gitignor file, but it seems nothing happens.

enter image description here

Upvotes: 2

Views: 670

Answers (1)

VonC
VonC

Reputation: 1327364

While a git rm --cached -r -- *.dex should be enough, don't forget it will only delete those files from the current commit.

If they are big, and should never have been committed, you would need to remove them from the full history of commits (assuming you are the only one working on this repository, or assuming you can warn your colleague about the impending git push --force)

Using newren/git-filter-repo

cd repo
git filter-repo --path-glob '*.dex' --invert-paths

Again, if those files are small, and with a limited history, a simple git rm --cached is enough.

Upvotes: 1

Related Questions