PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/work/merge_upstream.sh

http://github.com/tybor/Liberty
Shell | 48 lines | 38 code | 9 blank | 1 comment | 4 complexity | 12b3d0abf710a99aa4a63f1cfa92a1a1 MD5 | raw file
 1#!/bin/bash
 2
 3cd $(dirname $0)/..
 4
 5. ./work/tools.sh
 6
 7list_remotes() {
 8    git remote | egrep -v '^(key|origin|master|local.*)$'
 9}
10
11branch=$(git branch | awk '/^\*/ {print $2}')
12n=$(git remote | wc -l)
13
14title "Fetching branches"
15i=0
16for remote in $(list_remotes); do
17    progress 30 $i $n $remote
18    git fetch $remote
19    i=$((i+1))
20done
21progress 30 $i $n done.
22echo
23
24title "Switching to upstream branch"
25git checkout -q upstream/master
26
27title "Merging branches"
28i=0
29for remote in $(list_remotes); do
30    progress 30 $i $n $remote
31    git merge -q remotes/$remote/master
32    while [ $(git ls-files -u | wc -l) -gt 0 ]; do
33        echo
34        echo "There were conflicts while merging $remote:"
35        git ls-files -u
36        echo "Please solve them and press RETURN to continue."
37        read
38    done
39    i=$((i+1))
40done
41progress 30 $i $n done.
42echo
43
44title "Pushing back upstream"
45git push upstream
46
47title "Back to branch $branch"
48git checkout -q $branch