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?
views:
60answers:
4
+4
A:
Just add !
before an exclusion rule.
According to the gitignore man page:
Patterns have the following format:
...
- 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.
Robert Munteanu
2010-07-08 11:55:05
+8
A:
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.
Skilldrick
2010-07-08 11:55:30
+5
A:
You can simply git add -f path/to/foo.dll
.
.gitignore
ignores only files for usual tracking and stuff like git add .
Nils Riedemann
2010-07-08 11:56:14
+1
A:
!foo.dll
in .gitignore, or (every time!) git add -f foo.dll
Tobias Kienzler
2010-07-08 11:58:51