Force add despite the .gitignore file

Mark picture Mark · Nov 4, 2011 · Viewed 193.4k times · Source

Is there a way to force git to add a file despite the .gitignore file?

Answer

Daniel Böhmer picture Daniel Böhmer · Nov 4, 2011

See man git-add:

   -f, --force
       Allow adding otherwise ignored files.

So run this

git add --force my/ignore/file.foo