blob: 568b3423aa05710cf638290d99ddadfcbf50b666 (
plain)
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
34
35
36
37
38
39
40
|
#!/bin/bash
# Similar to git-cherry, except that it shows unmerged commits
# from all branches (including remotes).
base="${1:-master}"
remotes=("${@:2}")
if [[ "${#remotes[@]}" -eq 0 ]]; then
remotes=(refs/remotes)
fi
RED="\e[1;31m"
GREEN="\e[0;32m"
YELLOW="\e[0;33m"
BLUE="\e[1;34m"
PURPLE="\e[0;35m"
GRAY="\e[0;37m"
NONE="\e[0;0m"
for ref in $(git for-each-ref --format='%(refname)' "${remotes[@]}"); do
sha1="$(git rev-parse --verify $ref)"
if [ "$(git merge-base $ref $base)" = "$sha1" ]; then
continue
fi
echo -e "$sha1: ${RED}${ref}${NONE}"
git cherry -v $base $ref | while read line; do
case $line in
+*)
echo -e $BLUE$line$NONE
;;
-*)
echo -e $GRAY$line$NONE
;;
esac
done
echo
done
|