roundcrisis roundcrisis - 28 days ago 21
Git Question

git ignore exception

I have a gitignore file that makes git ignore

*.dll
files, and that is actually the behavior I want. However, if I want an exception ( i.e. to be able to commit
foo.dll
), how can I achieve this?

Answer

Use:

*.dll    #Exclude all dlls
!foo.dll #Except for foo.dll

From gitignore:

An optional prefix ! which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources.