git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin/git-update-all
diff options
context:
space:
mode:
authormail_redacted_for_web 2025-08-24 11:20:02 +0200
committermail_redacted_for_web 2025-08-24 11:20:02 +0200
commit986425af810e4995fe3da4684ce046c3c7610473 (patch)
treec68a215db7cf1a28c5317c9764ba201902ba3952 /bin/git-update-all
parentb93e1946642a36d38a18245a6104d002d70e664d (diff)
downloaddotfiles-testing.tar.bz2
InComm: small bash helper for git to update all local $thingstesting
Diffstat (limited to 'bin/git-update-all')
-rwxr-xr-xbin/git-update-all17
1 files changed, 17 insertions, 0 deletions
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}\$")