git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin/git-other-branches
blob: 034670ec80910abca24cc4b38d6a97def1ec591c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/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)\$" |\
	"$GREPBIN" -v '^HEAD$'