conquester conquester - 6 months ago 79
Git Question

.gitgnore file but not when under a specific directory

I have a Java project in which I am ignoring all jar files with the pattern in .gitignore:

*.jar


However, there are dependency files in the folder dependencies which are jar files but I don't want to exclude them.
How do I setup the .gitignore for this?

Answer Source

You can use a negated pattern to include files that were ignored by a previous pattern:

*.jar
!dependencies/*.jar
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download