diff options
Diffstat (limited to 'bin/git-other-branches')
| -rwxr-xr-x | bin/git-other-branches | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/git-other-branches b/bin/git-other-branches new file mode 100755 index 0000000..034670e --- /dev/null +++ b/bin/git-other-branches @@ -0,0 +1,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$' |
