Saturday, September 10, 2011

gitignore–Don’t ignore Nuget Binaries

September 10, 2011 Posted by Jason Irwin , 1 comment
I am pretty new to the GIT world and am excited to be moving a personal project from Subversion to GIT. As with most .NET developers’ .gitignore files, I use the following line to filter out DLLs so that I am not versioning build DLLs

I ran into an issue where I wanted to exclude all DLLs except for those stored in my Nuget packages directory. This wouldn’t in itself be an issue were it not for the fact that Nuget packages diverge wildly with respect to the number of nested sub-folders. Where one package might store it’s DLLs one folder down the directory hierarchy, another might store theirs down 10…

I searched for a recursive wildcard pattern that would work via mysysgit but hit a brick wall as none of the following worked:


While I hoped for a cleaner solution it turned out that all I had to do was add another .gitignore to my packages directory containing only the following line:


Obviously this would work just as well for !*.exe or any other relevant binary file type…