The shell used in the following examples is bash, but the commands can be adapted for other shells.
The goal here is to have a performant way to determine if we are in a git repo without printing anything.
git status --porcelain --untracked-files=no &>/dev/null && \