From 986425af810e4995fe3da4684ce046c3c7610473 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Sun, 24 Aug 2025 11:20:02 +0200 Subject: InComm: small bash helper for git to update all local $things --- bin/git-update-all | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 bin/git-update-all diff --git a/bin/git-update-all b/bin/git-update-all new file mode 100755 index 0000000..d3f6033 --- /dev/null +++ b/bin/git-update-all @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +GITBIN='/usr/bin/git' + +# 1. Pull the current branch and also tags, and prune references vanished from remote +"$GITBIN" pull -tpf || exit 110 +# 2. Pull all branches existing locally +mybr="$("$GITBIN" branch --show-current)" +while read -r branch +do + ( + printf '\033[1m\033[3mSwitching to %b.\033[0m\n' "$branch" + "$GITBIN" switch "$branch" &&\ + "$GITBIN" pull &&\ + "$GITBIN" switch "$mybr" + ) +done < <("$GITBIN" branch --list|awk '{print $NF}'|grep -vP "^${mybr}\$") -- cgit v1.2.3