I want git to stop tracking the .class files of my folder, I don't really need them to be tracked, I know I can put their names on .gitignore but is there a way to just ignore any future, past and present things that has the .class extension?
Asked
Active
Viewed 33 times
-1
-
For the future, put `*.class` in `.gitignore`. For the past also use `git rm --cached *.class` (with all the `.class` files you already have in your repository). For both, don't forget to commit after these operations. – axiac Dec 20 '22 at 21:00
-
Does this answer your question? [Git ignore doesn't ignore the specified folders/files](https://stackoverflow.com/questions/38658458/git-ignore-doesnt-ignore-the-specified-folders-files) – axiac Dec 20 '22 at 21:01
-
@axiac I fear it's not quite the same problem, but the *.class thing did solve my problem – Thay Dec 20 '22 at 21:11
-
It is the same problem, I saw it a dozen times in the past on [so]. You need to add `*.class` in `.gitignore` to tell Git to not add in the repo the `class` files in the future and you need to `git rm --cached` **all the `class` files that currently exists in the repo**. After you commit these changes, the `class` files won't bother you again. – axiac Dec 20 '22 at 21:16
-
I don't think it is, that guy already knew about *.class and was having a comprehension problem, I simply didn't know *.class was such a thing. I saw that question before and it didn't help me at all – Thay Dec 20 '22 at 21:27
1 Answers
0
Yes there is! Just add this (on a separate line) to your .gitignore
:
*.class
The *
serves as a wildcard to match any string (so it could be any file name)

Koedlt
- 4,286
- 8
- 15
- 33