-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgg-feature-open
executable file
·32 lines (27 loc) · 1021 Bytes
/
gg-feature-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
#!/bin/bash
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
get_currentBranch
get_currentBranchType
if [[ $currentBranchType == 'master' && $currentBranchType == 'release' ]]; then
printf "\nYou can NOT create a new feature branch in master or release branchs!\n\tIf you are in master, stash and goto develop to fix issues\n\tIf you are in release, it seems that you should abort your release (git stash (if you want to save some changes and then) git branch -D \"$currentBranch\") and go to fix the issues and then make a new release"
git status
exit 1
fi
if [[ $currentBranchType != 'develop' ]]; then
postfix="-FromBranch-$currentBranch"
else
postfix=
fi
if [[ "$#" != "1" ]]; then
printf "Please input feature name\n"
exit 1
fi
get_develop
get_feature
printf "Do you what to open a new feature branch like this?\n"
gggttt;echo "git checkout -b \"$feature/$1$postfix\""
echo "press ENTER to continue, press Ctrl+c to ESCAPE"
read temp
git checkout -b "$feature/$1$postfix"