Skip to content

Instantly share code, notes, and snippets.

@bulletinmybeard
Created January 7, 2024 16:49
Show Gist options
  • Save bulletinmybeard/754fbfbb328ddf92c42283a73ce5c722 to your computer and use it in GitHub Desktop.
Save bulletinmybeard/754fbfbb328ddf92c42283a73ce5c722 to your computer and use it in GitHub Desktop.
Verify .gitignore rules
# Without colors
find . -type f | git check-ignore -v --stdin | sort | uniq -c | awk '{for (i=2; i<=NF; i++) printf "%s ", $i; printf "\n"}'

# With colors
find . -type f | git check-ignore -v --stdin | sort | uniq -c | awk '{printf "\033[43;30m%s\033[0m", $2; for (i=3; i<=NF; i++) printf "\033[46;30m %s\033[0m", $i; printf "\n"}'

ANSI color codes

Entry Background color Background ANSI Code Text color Text ANSI Code
Gitignore Rule Yellow 43 Black 30
Ignored Path Cyan 46 Black 30
E.g.,
.gitignore:42:.coverage ./.coverage
.gitignore:50:.pytest_cache/ ./.pytest_cache/README.md
.gitignore:52:junit.xml ./junit.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment