Git current branch
The shell used in the following examples is bash, but the commands can be adapted for other shells.
Determine if working in a git repository
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 && \