gitmaven-2version-controlgitignore

Git Ignores and Maven targets


Anyone know if it is possible to ignore all the instances of a particular directory in a file structure managed by Git?

I'm looking to exclude all the target folders in a Maven project with a number of submodules. I know I can explicitly exclude each of them in a top level .gitignore, but I'd really like to be able to specify a pattern like **/target/* there to have it automatically ignore the instance in sub directories?

Is this possible?


Solution

  • It is possible to use patterns in a .gitignore file. See the gitignore man page. The pattern */target/* should ignore any directory named target and anything under it. Or you may try */target/** to ignore everything under target.