aboutsummaryrefslogtreecommitdiffstats
path: root/nya
blob: 614e9706183401a9e066415db085f027d1e4a92c (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
#!/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
	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