Exceptions in .gitignore
Use !
to negate the pattern:
*.dll
!myfile.dll
You can also ignore folders like
!src/main/resources/archetype-resources/**/*
you can also ignore nested folder with patterns like
!**/src/test/resources/**/*
For quick creation of .gitignore file try gitignore.io
If you want to ignore whole folder, except some specific files, then write:
MyFolder/*
!MyFolder/CoolFile.txt
This won't work:
MyFolder/
!MyFolder/CoolFile.txt