-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgraduate-rc.sh
47 lines (34 loc) · 1.03 KB
/
graduate-rc.sh
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
40
41
42
43
44
45
46
47
#!/bin/bash
BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
echo "Graduating master branch to rc branch..."
sh clean.sh || exit 1
if [ "$BRANCH" = "dev" ]; then
echo "Currently in dev branch. Checking out master branch..."
git checkout master || exit 1
fi
echo ""
echo "Fetching from origin..."
git fetch origin || exit 1
echo ""
echo "Pulling the master branch from origin (to update it locally)..."
git pull origin master || exit 1
echo ""
echo "Merging the rc branch into the master branch..."
git merge rc || exit 1
echo ""
echo "Checking out the rc branch..."
git checkout rc || exit 1
echo ""
echo "Pulling the rc branch from origin (to update it locally)..."
git pull origin rc || exit 1
echo ""
echo "Merging the master branch into the rc branch..."
git merge master || exit 1
echo ""
echo "Pushing the updated rc branch to origin..."
git push origin rc || exit 1
echo ""
echo "Checking out the $BRANCH branch again..."
git checkout $BRANCH || exit 1
echo ""
echo "The 'master' branch has been graduated to the 'rc' branch"