-
Notifications
You must be signed in to change notification settings - Fork 9
/
gg-release-close
executable file
·49 lines (45 loc) · 1.57 KB
/
gg-release-close
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
49
#!/bin/bash
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
get_currentBranch
get_currentBranchType
get_version
if [[ $currentBranchType != 'release' ]]; then
printf "\nYou must be in one release branch!\n\n"
git status
exit 1
fi
get_master
get_develop
echo "You are in branch || $currentBranch ||"
printf "Do you want to close it like this?\n"
gggttt;echo "git checkout \"$master\""
gggttt;echo "git merge --no-ff \"$currentBranch\""
if [[ -n $version ]]; then
gggttt;echo "git tag -a \"$version\""
fi
gggttt;echo "git checkout \"$develop\""
gggttt;echo "git merge --no-ff \"$currentBranch\""
gggttt;echo "git branch -d \"$currentBranch\""
echo;echo "if you meet conflicts in merges, you should delete the branch manully"
echo "press ENTER to continue, press Ctrl+c to ESCAPE"
read temp
git checkout "$master"
if [[ -n $version ]]; then
git merge --no-ff "$currentBranch" -m "Merge release branch $currentBranch into $master" && git tag -a "$version" -m "$version"
else
git merge --no-ff "$currentBranch" -m "Merge release branch into $master"
fi
git checkout "$develop"
if [[ -n $version ]]; then
git merge --no-ff "$currentBranch" -m "Merge release branch $currentBranch into $develop"\
&& echo "press Enter to delete branch $currentBranch"\
&& echo "press Ctrl+c to ESCAPE"\
&& read temp &&git branch -d "$currentBranch"
else
git merge --no-ff "$currentBranch" -m "Merge release branch into $develop"\
&& echo "press Enter to delete branch $currentBranch"\
&& echo "press Ctrl+c to ESCAPE"\
&& read temp &&git branch -d "$currentBranch"
fi