-
Notifications
You must be signed in to change notification settings - Fork 1
/
graduate-lts.sh
48 lines (34 loc) · 1.08 KB
/
graduate-lts.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
48
#!/bin/bash
BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
echo "Graduating master branch to lts branch..."
sh clean.sh || exit 1
echo ""
echo "Fetching from origin..."
git fetch origin || exit 1
if [ "$BRANCH" = "dev" ]; then
echo "Currently in dev branch. Checking out master branch..."
git checkout master || exit 1
fi
#echo ""
#echo "Pulling the master branch from origin (to update it locally)..."
#git pull origin master || exit 1
echo ""
echo "Merging the lts branch into the master branch..."
git merge -X ours origin/lts || exit 1
echo ""
echo "Checking out the lts branch..."
git checkout lts || exit 1
#echo ""
#echo "Pulling the lts branch from origin (to update it locally)..."
#git pull origin lts || exit 1
echo ""
echo "Merging the master branch into the lts branch..."
git merge -X theirs origin/master || exit 1
echo ""
echo "Pushing the updated lts branch to origin..."
git push origin lts -q || 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 'lts' branch"