actually do what the last commit promised
[socialgit.git] / bin / mergefrommaster
blobeb7b6aa7d1029bcbe907633c3ad8b0e03fa8a769
1 #!/bin/sh
2 # mergefrommaster
4 CURBRANCH=`currentbranchname`
6 MESSAGE=$(ls .mergefrommastermessage 2>/dev/null && cat .mergefrommastermessage)
7 if ( test $MESSAGE ); then
8 git commit -m $MESSAGE
9 rm .mergefrommastermessage
10 exit
11 else
13 changebranch master
14 updatebranch
15 changebranch $CURBRANCH
16 MESSAGE="Pulling $(git rev-list --reverse $CURBRANCH..master | wc -l | cut -d" " -f8) commits from 'master' to '$CURBRANCH'.
18 for commitid in `git rev-list --reverse $CURBRANCH..master`; do
19 MESSAGE="$MESSAGE
20 $(git log -1 --pretty=format:'%s (%cD by %cn <%ce>)' $commitid)";
21 done
22 git merge -m "$MESSAGE" master
23 if ( git merge master|grep "You are in the middle of a conflicted merge." ); then
24 GITROOT=$PWD/`git rev-parse --show-cdup`
25 echo $MESSAGE > .mergefrommastermessage
26 echo "Need to resolve conflicts from merging in master changes before continuing with a git-commit."
27 exit -1