mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Check How A File Is Being Ignored as a Git TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1468 TILs and counting..._
|
_1469 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -276,6 +276,7 @@ _1468 TILs and counting..._
|
|||||||
- [Auto-Squash Those Fixup Commits](git/auto-squash-those-fixup-commits.md)
|
- [Auto-Squash Those Fixup Commits](git/auto-squash-those-fixup-commits.md)
|
||||||
- [Caching Credentials](git/caching-credentials.md)
|
- [Caching Credentials](git/caching-credentials.md)
|
||||||
- [Change The Start Point Of A Branch](git/change-the-start-point-of-a-branch.md)
|
- [Change The Start Point Of A Branch](git/change-the-start-point-of-a-branch.md)
|
||||||
|
- [Check How A File Is Being Ignored](git/check-how-a-file-is-being-ignored.md)
|
||||||
- [Checking Commit Ancestry](git/checking-commit-ancestry.md)
|
- [Checking Commit Ancestry](git/checking-commit-ancestry.md)
|
||||||
- [Checkout Old Version Of A File](git/checkout-old-version-of-a-file.md)
|
- [Checkout Old Version Of A File](git/checkout-old-version-of-a-file.md)
|
||||||
- [Checkout Previous Branch](git/checkout-previous-branch.md)
|
- [Checkout Previous Branch](git/checkout-previous-branch.md)
|
||||||
|
|||||||
28
git/check-how-a-file-is-being-ignored.md
Normal file
28
git/check-how-a-file-is-being-ignored.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Check How A File Is Being Ignored
|
||||||
|
|
||||||
|
There are a few places on your machine where you can specify the files that git
|
||||||
|
should ignore. The most common is a repository's `.gitignore` file. The other
|
||||||
|
places those excludes are specified can be more obscure. Fortunately, `git
|
||||||
|
check-ignore` is a command that can show you specifically where.
|
||||||
|
|
||||||
|
For instance, let's check why my `notes.md` file is being ignored.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git check-ignore -v .DS_Store
|
||||||
|
.git/info/exclude:7:notes.md notes.md
|
||||||
|
```
|
||||||
|
|
||||||
|
At some point I added it to my repo's `.git/info/exclude` file. The `-v` flag
|
||||||
|
(_verbose_) when included with `check-ignore` tells me the file location.
|
||||||
|
|
||||||
|
How about these pesky `.DS_Store` directories? How are those being ignored?
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git check-ignore .DS_Store -v
|
||||||
|
/Users/jbranchaud/.gitignore:3:.DS_Store .DS_Store
|
||||||
|
```
|
||||||
|
|
||||||
|
Ah yes, I had added it to my _global exclude file_ which I've configured in
|
||||||
|
`~/.gitconfig` to be the `~/.gitignore` file.
|
||||||
|
|
||||||
|
See `man git-check-ignore` for more details.
|
||||||
Reference in New Issue
Block a user