Since the gitignore file is for things we want to be there in the directory (e.g. IDE config) but don't want to include in the repo, should we remove the auto-generated files from the .gitignore file? Or else git clean cannot remove them. As far as I know, keeping old Makefiles can be problematic when compiling.
No, it's perfectly normal to have the generated makefiles in the gitignore file.
The idea is for the source tree to only contain actual sources and not generated files.
Also, since the generated Makefiles can differ from one system to another, keeping them in the git tree can have weird behaviors.
I was suggesting that neither the tree nor .gitignore contain the generated Makefiles, so git clean can delete them all.