-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgit-listb
executable file
·25 lines (19 loc) · 1.03 KB
/
git-listb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# Copyright (c) 2019-2020 Benjamin Holt -- MIT License
if [ "$1" == "-h" -o "$1" == "--help" ]; then
cat <<USAGE
usage: git listb List git branches that have different local
vs. remote names (like ones created with newb)
git listb -h|--help Print this message and exit
USAGE
exit 0
fi
# Bold=`tput bold`
# Off=`tput sgr0`
ConfigRemote=`git config bettergit.defaultremote`
: ${DefaultRemote:=${ConfigRemote:-"origin"}}
# Delete lines where the local branch matches the remote branch (ignoring ahead/behind annotations like "[origin/master: behind 86]")
# git branch -vv | sed -e '/^[* ] \([^ ][^ ]*\) *[a-fA-F0-9][a-fA-F0-9]* *\['$DefaultRemote'\/\1\(:.*\)*\]/d' # REM: for some reason, I couldn't get backrefs to work in extended re :-/
# Delete lines *other than the current branch* where...
git branch -vv | sed -e '/^ \([^ ][^ ]*\) *[a-fA-F0-9][a-fA-F0-9]* *\['$DefaultRemote'\/\1\(:.*\)*\]/d' # REM: for some reason, I couldn't get backrefs to work in extended re :-/
###