1.1 KiB
1.1 KiB
date | tags | |
---|---|---|
2021-03-19T09:30 |
|
check non-trivial gitignore patterns using git check-ignore
today i ran into an issue where i tried creating a new bin/
dir in a git
repo, and trying to add the files within to a new commit, but was greeted by:
$ git add bin/README.md
The following paths are ignored by one of your .gitignore files:
bin
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"
confused, i ran a simple grep
on the project's .gitignore
:
$ grep bin .gitignore
which yielded nothing. i was pretty sure i didn't have that pattern set in my global gitignore, either.
a quick internet search turned up a git util that is new to me:
https://git-scm.com/docs/git-check-ignore
using this command, i was able to trace the exact line responsible:
git check-ignore -v bin
.gitignore:123:[Bb]in bin
ohhhhh, oops. well, that makes sense. neat! this could've been solved with a
more sophisticated grep
pattern, but who has time for that?