brettcannon, Looking for a Bash one-liner to tell by exit code whether your Git checkout is dirty?
if [ -n "$(git status --porcelain)" ]; then (exit 1); fi
I sought this out for GitHub Actions so that I could set up a formatting command for a project and then check in CI if it would change anything instead of having a second command just for the check (e.g.
black
followed by this in CI instead of having a separate, dedicatedblack --check
just for CI). Basically trying up the DRY on maintenance stuff