I'm not aware of any built-in way to achieve that. However, you could easily create an alias for this, to make it less of a hassle:
$ git config alias.xclean "clean -xdf -e .project"
Then you can just run git xclean
and it will do what you want.
This example configures the alias only for the local working tree. To have it for all git repos on your machine, add the --global
flag to git config
.