Al Phaba Al Phaba - 3 months ago 18
Git Question

How to remove generated files in Git repo?

I created a git repo and worked a bit on my android projekt, but now I recognize that I added files into the repo which will change each time because they are generated. How can I remove them and be sure that wont be added again.

I have already added them to the .gitignore which locks like this

bin/classes/**
gen/**
bin/PDiXUploader.apk
bin/classes.dex
bin/resources.ap_
gen/de/srs/android/pdixuploader/R.java


But now I am not certain how to delete it from the repo so that it wont be under version control.

This is my git status log

$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: bin/PDiXUploader.apk
# modified: bin/classes.dex
# modified: bin/resources.ap_
# modified: gen/de/srs/android/pdixuploader/R.java
# modified: res/layout/activity_instance_selection.xml
# modified: res/layout/activity_main.xml
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# res/values/dimens.xml
no changes added to commit (use "git add" and/or "git commit -a")


Thanks

Answer
git rm <file>

Should remove the file from the repo for you.

Comments