git add on a file excluded by .gitignore

git

Solution

Well I was having a tough time finding an answer to this, but to be honest I hadn't tried it yet. Turns out running 'git add' (like below) on a file excluded in .gitignore

git add Test.exe

outputs the following:

The following paths are ignored by one of your .gitignore files:
Test.exe
Use -f if you really want to add them.
fatal: no files added

So revising 'git add' like so will work:

git add -f Test.exe

Problem

Is there a way to track a new file in git that is excluded by a rule present in .gitignore? I would like to do this without adding a single file/directory exclusion in my .gitignore rules.

Original source