git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authormail_redacted_for_web 2026-01-26 12:39:07 +0100
committermail_redacted_for_web 2026-01-26 12:39:07 +0100
commit373c3896729312b6f0d74d9bb37c41d966427f25 (patch)
treed243ef78aad2c54a6b009def773ee4b9d4615f2f /bin
parent986425af810e4995fe3da4684ce046c3c7610473 (diff)
downloaddotfiles-373c3896729312b6f0d74d9bb37c41d966427f25.tar.bz2
Adding an "other-branches" script to git
Diffstat (limited to 'bin')
-rw-r--r--bin/git-other-branches11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/git-other-branches b/bin/git-other-branches
new file mode 100644
index 0000000..729ba61
--- /dev/null
+++ b/bin/git-other-branches
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+GITBIN='/usr/bin/git'
+AWKBIN='/usr/bin/awk'
+GREPBIN='/usr/bin/grep'
+
+# 1. Pull the current branch and also tags, and prune references vanished from remote
+# shellcheck disable=SC2016
+"$GITBIN" branch --remotes |\
+ "$AWKBIN" '{print $1}' | "$AWKBIN" -F/ '{print $2}' |\
+ "$GREPBIN" -v "^$(git rev-parse --abbrev-ref HEAD)\$"