-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgg-hotfix-open
executable file
·37 lines (34 loc) · 1.07 KB
/
gg-hotfix-open
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
#!/bin/bash
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
get_currentBranch
get_currentBranchType
if [[ $currentBranchType != 'master' ]]; then
printf "\nYou must be in the master branch to create a new hotfix branch!\n\n"
git status
exit 1
fi
if [[ "$#" != "1" ]]; then
echo "your are in branch $currentBranch, Please input the hotfix number"
printf "Current tag names are\n"
git --no-pager tag
exit 1
fi
get_hotfix
printf "Do you what to open a new hotfix branch like this?\n"
if [[ "$1" == "none" ]]; then
gggttt;echo "git checkout -b \"$hotfix\""
gggttt;echo "git commit --allow-empty -m \"Start hotfix\""
echo "press ENTER to continue, press Ctrl+c to ESCAPE"
read temp
git checkout -b "$hotfix"
git commit --allow-empty -m "Start hotfix"
else
gggttt;echo "git checkout -b \"$hotfix-$1\""
gggttt;echo "git commit --allow-empty -m \"Start hotfix version $1\""
echo "press ENTER to continue, press Ctrl+c to ESCAPE"
read temp
git checkout -b "$hotfix-$1"
git commit --allow-empty -m "Start hotfix version $1"
fi