Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git ignore exception

Tags:

git

gitignore

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?

like image 749
roundcrisis Avatar asked Jul 08 '10 11:07

roundcrisis


2 Answers

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.

like image 137
Skilldrick Avatar answered Sep 22 '22 10:09

Skilldrick


Git ignores folders if you write:

/js 

but it can't add exceptions if you do: !/js/jquery or !/js/jquery/ or !/js/jquery/*

You must write:

/js/*  

and only then you can except subfolders like this

!/js/jquery 
like image 23
Matiss Avatar answered Sep 23 '22 10:09

Matiss