Skip to content

Commit cfddef5

Browse files
committed
Use a default remote when none is given
1 parent 3bea853 commit cfddef5

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

remote-branch-info.sh

100644100755
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,26 @@
55
#
66
# This is useful for analyzing which branches are obsolete and/or moldy.
77

8-
remote="$@"
8+
remote="$*"
99
if [ "$remote" == "" ];
1010
then
11+
remote=$(git rev-parse --symbolic-full-name HEAD@{u})
12+
remote=${remote%/*}
13+
remote=${remote#refs/remotes/}
14+
echo Using remote $remote
15+
fi
16+
17+
case "$remote" in
18+
--help|-h)
1119
echo Please specify one of the following remotes:
1220
git remote
1321
exit 1
14-
fi
22+
;;
23+
esac
1524

1625
for ref in $(git for-each-ref refs/remotes/$remote --format='%(refname)')
1726
do
27+
1828
refname=${ref#refs/remotes/$remote/}
1929
unmerged_count=$(git cherry master $ref | grep '^+' | wc -l)
2030
info=$(git log -n 1 --format='%an - %ar' $ref)

0 commit comments

Comments
 (0)