The solution depends on the relation between the git ignore rule and the exception rule:
- Files/Files at the same level: use the @Skilldrick solution.
- Folders/Subfolders: use the @Matiss Jurgelis solution.
Files/Files in different levels or Files/Subfolders: you can do this:
*.suo *.user *.userosscache *.sln.docstates # ... # Exceptions for entire subfolders !SetupFiles/elasticsearch-5.0.0/**/* !SetupFiles/filebeat-5.0.0-windows-x86_64/**/* # Exceptions for files in different levels !SetupFiles/kibana-5.0.0-windows-x86/**/*.suo !SetupFiles/logstash-5.0.0/**/*.suo