I thought that I was pretty familiar with how to use .gitignore
(which still works great for me for excluding top level directories), but I now discovered that multiple R.java
files from various libraries used in my application are being tracked and I would like to stop tracking them.
I tried adding the line R.java
to the .gitignore
in the top level directory, but git status
keeps reporting them as modified.
I then tried adding the line */gen/
to the .gitignore
in the top level directory, but git status
still reports them as modified.
What is the trick to tell git to stop tracking them?
.gitignore
should stop them from being indexed. Did you delete the unwanted files with git rm
or rm
?
You need to first remove them from the repo ( git rm
or git rm --cached
and commit) for the ignore to work as git does not ignore tracked / versioned files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With