WorkingGuideLines: mc-merge

File mc-merge, 1.1 KB (added by zaytsev, 14 years ago)
Line 
1#!/bin/bash
2
3set -e
4
5function pause() {
6   read -p "$*"
7}
8
9if [ $# -ne 2 ]
10then
11  echo "Usage: `basename $0` BRANCH_FROM BRANCH_TO"
12  exit 1
13fi
14
15BRANCH_FROM=$1
16BRANCH_TO=$2
17
18echo "Checking out branch $BRANCH_TO..."
19git checkout $BRANCH_TO
20
21echo "Pulling latest changes into $BRANCH_TO..."
22git pull
23
24echo "Checking out branch in question ($BRANCH_FROM)..."
25git checkout $BRANCH_FROM
26
27pause "Rebasing $BRANCH_FROM on top of $BRANCH_TO... OK?"
28git rebase origin/$BRANCH_TO
29
30echo "Checking out branch $BRANCH_TO..."
31git checkout $BRANCH_TO
32
33echo "Pulling latest changes into $BRANCH_TO..."
34git pull
35
36pause "Merging $BRANCH_FROM with $BRANCH_TO... OK? (If there were updates on the previous step, press CTRL+C to abort!)"
37git merge --log --no-ff $BRANCH_FROM
38
39echo "Starting gitk to make sure you like the result..."
40gitk
41
42pause "Push to the origin!? (Press CTRL+C to abort!)"
43git push origin $BRANCH_TO
44
45pause "Proceed with the cleanup? (Press CTRL+C to abort!)"
46git push origin :$BRANCH_FROM
47git branch -d $BRANCH_FROM
48
49echo "Congratulations! Yet another glorious merge succesfully completed!"
50
51exit 0