Skip to content

Commit 50aec59

Browse files
committed
Add script for analyzing remote branches
0 parents  commit 50aec59

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

remote-branch-info.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Simple script to list last author and commit date, as well as number of
4+
# unmerged commits, for each remote branch of a given remote.
5+
#
6+
# This is useful for analyzing which branches are obsolete and/or moldy.
7+
8+
remote="$@"
9+
if [ "$remote" == "" ];
10+
then
11+
echo Please specify one of the following remotes:
12+
git remote
13+
exit 1
14+
fi
15+
16+
for ref in $(git for-each-ref refs/remotes/$remote --format='%(refname)')
17+
do
18+
refname=$(echo $ref | sed -e "s-refs/remotes/$remote/--")
19+
unmerged_count=$(git cherry master $ref | grep '^+' | wc -l)
20+
info=$(git log -n 1 --format='%an - %ar' $ref)
21+
echo $refname - $info - $unmerged_count unmerged
22+
done

0 commit comments

Comments
 (0)