Merge branch 'vk/testmain' into vk/test
[wrffire.git] / other / pull
blob7e91c6108a9920bb08722fd1a121f6fb938b8090
1 #!/bin/bash
3 echo fetching:
4 git fetch
5 stat=$?
6 if [ $stat -ne 0 ] ; then
7 exit $stat
8 fi
10 echo
11 echo checking for local changes:
12 cmt=$(git diff --name-only | wc -l )
13 if [ $cmt -ne 0 ] ; then
14 git diff --name-status | cat
15 echo
16 echo 'local changes detected, run git commit first'
17 exit 1
19 cbr=$(git branch |grep \* | sed 's|\*||')
21 echo
22 branch=$( (git branch | sed 's|\*| |' ; git branch -r | sed 's|origin/||' ) | sort |uniq -d )
23 j=0
24 for i in $branch ; do
25 echo merging origin/$i to $i:
26 git checkout -f $i
27 git merge origin/$i
28 stat=$?
29 if [ $stat -ne 0 ] ; then
30 mfail[$((j++))]=$i
31 git reset --hard
33 echo
34 done
36 git checkout -f $cbr
37 echo
39 if [ $j -ne 0 ] ; then
40 echo 'automatic merging of the following branches failed due to conflicts:'
41 echo ${mfail[*]}
42 else
43 echo 'all local branches merged successfully'