From f4ec896c79918ed3e83a262a3a7745a4ccf56de0 Mon Sep 17 00:00:00 2001 From: home Date: Mon, 27 Nov 2023 21:30:39 +0300 Subject: [PATCH] PS1 : Show git branch only when non-master. --- .config/bash/module/ps1.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/bash/module/ps1.sh b/.config/bash/module/ps1.sh index c177733..17f3cb2 100644 --- a/.config/bash/module/ps1.sh +++ b/.config/bash/module/ps1.sh @@ -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