juanpastas juanpastas - 3 months ago 17
Git Question

Where file is ignored by .gitignore

I am doing

git add db/schema.rb
The following paths are ignored by one of your .gitignore files:
db/schema.rb
Use -f if you really want to add them.
fatal: no files added


Where can I find this file is being ignored, see:

cat .gitignore
.project
nbproject
.redcar
cat ~/.gitignore
.idea


~/.gitignore
is for global ignores.

Answer

You can easily check what .gitignore rule is currently making your file ignored in your git repo with git check-ignore (you must have git 1.8.3.3+):

cd /path/to/your/repo
git check-ignore -v -- path/to/your/file

(The -v -- verbose -- option is important to see the rule)