How to ignore certain files in Git
问题 I have a repository with a file, Hello.java . When I compile it, an additional Hello.class file is generated. I created an entry for Hello.class in a .gitignore file. However, the file still appears to be tracked. How can I make Git ignore Hello.class ? 回答1: The problem is that .gitignore ignores just files that weren't tracked before (by git add ). Run git reset name_of_file to unstage the file and keep it. In case you want to also remove the given file from the repository (after pushing),