Skip to content

Instantly share code, notes, and snippets.

@nepsilon
Last active July 9, 2024 19:14
Show Gist options
  • Save nepsilon/ee328cbfd3c0c9830fc96517e0927d26 to your computer and use it in GitHub Desktop.
Save nepsilon/ee328cbfd3c0c9830fc96517e0927d26 to your computer and use it in GitHub Desktop.
Understand what .gitignore rule is ignoring your files — First published in fullweb.io issue #54

Understand what .gitignore rule is ignoring your files

Ready to commit, you fire your git status and you don’t see your files 🤔.

Use this command to ask Git what rule is causing this ignore:

$ git check-ignore -v filename

For instance to see what rule ignores tests.pyc:

$ git check-ignore -v tests.pyc
.gitignore:1:*.pyc    tests.pyc

Here we see it’s the first line of the .gitignore file that is in effect. You can also use git status --ignored to show the files being ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment