From e1155e3a008f3d8f72e17623bc54198fda878921 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Sat, 14 Oct 2023 14:07:01 +0200 Subject: [PATCH] show additional branches --- gis | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gis b/gis index 5b5dbe2..8f596f6 100755 --- a/gis +++ b/gis @@ -174,6 +174,10 @@ for dir in "${git_dirs[@]}"; do origin_head="$current_branch" fi + # Get number of additional local branches + num_branches=$(git branch | wc -l) + num_additional_branches=$(( num_branches - 1 )) + status_keys="" # Check stash @@ -216,10 +220,16 @@ for dir in "${git_dirs[@]}"; do # Construct branch output if [ "$current_branch" = "$origin_head" ]; then - output="${output};${text_bold}${current_branch}${text_reset}\n" + output="${output};${text_bold}${current_branch}${text_reset}" else - output="${output};${text_bold}${text_yellow}${current_branch}${text_reset} (${origin_head}${text_reset})\n" + num_additional_branches=$(( num_additional_branches - 1 )) + output="${output};${text_bold}${text_yellow}${current_branch}${text_reset} (${origin_head}${text_reset})" fi + if [[ $num_additional_branches -gt 0 ]]; then + output="${output} (+${num_additional_branches})" + fi + + output="${output}\n" done