From 9184d50bdbfc608f02e9e034b22d29bf80afcfb1 Mon Sep 17 00:00:00 2001 From: suchAdemon Date: Wed, 29 Aug 2018 13:51:48 +0200 Subject: [PATCH] git_co_all_branches.sh: optimized work of script --- git_co_all_branches.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git_co_all_branches.sh b/git_co_all_branches.sh index 199e137..58aafc8 100755 --- a/git_co_all_branches.sh +++ b/git_co_all_branches.sh @@ -1,12 +1,13 @@ #!/bin/bash +activebranch="$(/usr/bin/git branch | /bin/grep "\*" | awk '{print $2}')" echo "============= GIT CO BRANCHES =============" -for f in $(git br -a | grep remotes | grep -v "remotes/origin/HEAD" | awk '{print $1}' | cut -f3 -d\/) +for f in $(/usr/bin/git branch -a | /bin/grep remotes | /bin/grep -v "remotes/origin/HEAD" | awk '{print $1}' | cut -f3 -d\/) do echo "Checkout: ${f}" - git checkout "${f}" --quiet + /usr/bin/git checkout "${f}" --quiet done +/usr/bin/git checkout "${activebranch}" --quiet echo "===========================================" -