random vim note
This commit is contained in:
parent
4830f8c1f2
commit
d999ecfadd
2 changed files with 45 additions and 1 deletions
45
72e6c820.md
Normal file
45
72e6c820.md
Normal file
|
@ -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?
|
|
@ -1 +0,0 @@
|
|||
Put your [static files](https://neuron.zettel.page/2016401.html) (images, pdf, etc.) here.
|
Loading…
Add table
Reference in a new issue