Takes the default macOS zsh prompt and adds colour to the path, a branch name if present, and marks that changes are made if true.
Admittedly could probably do with some optimising.
Add (or create) the following to the ~/.zshrc
file.
# ~/.zshrc
autoload -Uz vcs_info # enable vcs_info
precmd () { vcs_info } # always load before displaying the prompt
zstyle ':vcs_info:*' formats ' (%F{34}%{⤴%G%} %b%f)'
function parse_git_dirty {
inside_git_repo="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
if [ "$inside_git_repo" ]; then
if git diff-index --quiet HEAD
then
echo ""
else
echo " ●"
fi
else
echo ""
fi
}
setopt PROMPT_SUBST
export PROMPT='%n@%m %F{220}%1~%f${vcs_info_msg_0_}%F{202}$(parse_git_dirty)%f %% '