forked from scijava/scijava-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote-branch-info.sh
More file actions
executable file
·33 lines (28 loc) · 861 Bytes
/
Copy pathremote-branch-info.sh
File metadata and controls
executable file
·33 lines (28 loc) · 861 Bytes
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
26
27
28
29
30
31
32
33
#!/bin/bash
# Simple script to list last author and commit date, as well as number of
# unmerged commits, for each remote branch of a given remote.
#
# This is useful for analyzing which branches are obsolete and/or moldy.
remote="$*"
if [ "$remote" == "" ];
then
remote=$(git rev-parse --symbolic-full-name HEAD@{u})
remote=${remote%/*}
remote=${remote#refs/remotes/}
echo Using remote $remote
fi
case "$remote" in
--help|-h)
echo Please specify one of the following remotes:
git remote
exit 1
;;
esac
for ref in $(git for-each-ref refs/remotes/$remote --format='%(refname)')
do
refname=${ref#refs/remotes/$remote/}
case "$refname" in contrib|master) continue;; esac
unmerged_count=$(git cherry master $ref | grep '^+' | wc -l)
info=$(git log -n 1 --format='%an - %ar' $ref)
echo $refname - $info - $unmerged_count unmerged
done