diff --git a/72e6c820.md b/72e6c820.md new file mode 100644 index 0000000..caa2c56 --- /dev/null +++ b/72e6c820.md @@ -0,0 +1,45 @@ +--- +date: 2021-03-19T09:30 +tags: + - git +--- + +# 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: + +```bash +$ 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`: + +```bash +$ 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: + +```bash +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? diff --git a/static/README.md b/static/README.md deleted file mode 100644 index a594aee..0000000 --- a/static/README.md +++ /dev/null @@ -1 +0,0 @@ -Put your [static files](https://neuron.zettel.page/2016401.html) (images, pdf, etc.) here.