blob: ed215e56460ee864d3e2bd5fdf750d7efa5caced (
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
41
42
43
44
45
46
47
|
#!/bin/sh
list_branches() {
fmt='
d=%(committerdate:short)
r=%(refname)
echo "$d ${r#refs/heads/}"
'
t=`git for-each-ref --sort=-committerdate --format="$fmt" refs/heads`
eval "$t"
}
git update-index --refresh || exit 1
case "$(git diff-index --name-status HEAD)" in
'') ;;
*)
echo "there are local modifications"
exit 1
esac
# reset first
git fetch upstream --progress
git reset --hard upstream/trunk
# then merge branches
git fetch origin --progress
git merge --no-edit --no-ff rhe-tools || exit 2
while list_branches && echo -n "> " && read line; do
if ORIGIN_HEAD=$(git rev-parse "origin/$line"); then
LOCAL_HEAD=$(git rev-parse "$line")
if [ "x$LOCAL_HEAD" != "x$ORIGIN_HEAD" ]; then
echo "origin and local differs?"
exit 1
fi
fi
echo "merging branch $line"
while :; do
if git merge --no-edit --no-ff "$line"; then
break
fi
echo -n "merge failed; press a key to retry"
read
done
done
|