git_co_all_branches.sh: optimized work of script

This commit is contained in:
Oliver Schraml 2018-08-29 13:51:48 +02:00 committed by suchademon
parent affdec1bfa
commit 9184d50bdb
Signed by: oliver.schraml
GPG Key ID: A55864B79D0D0228
1 changed files with 4 additions and 3 deletions

View File

@ -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 "==========================================="