PS1 : Show git branch only when non-master.

This commit is contained in:
Dmitry Voronin 2023-11-27 21:30:39 +03:00
parent 125ef0af69
commit f4ec896c79

View file

@ -45,7 +45,9 @@ __prompt_command()
# Add git branch if available.
local git_branch="$(_git_current_branch)"
[[ "${git_branch}" = "" ]] || PS1+=" ${color_blue}@${git_branch}"
if [[ "${git_branch}" != "" ]]; then
[[ "${git_branch}" =~ (master|main) ]] || PS1+=" ${color_bblue}@${git_branch}"
fi
# set error red
if $is_error; then