-
Notifications
You must be signed in to change notification settings - Fork 9
/
gg-feature-close-rebase
executable file
·39 lines (35 loc) · 1.12 KB
/
gg-feature-close-rebase
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
#!/bin/bash
installPath=/usr/local/bin/gg
source $installPath/gg-functions
testClear
get_currentBranch
get_currentBranchType
if [[ $currentBranchType != 'feature' ]]; then
printf "You must be in one feature branch!\n\n"
git status
exit 1
fi
get_father
if [[ -z "$(git branch | grep -v $currentBranch | grep $father)" ]]; then
get_develop
echo "do not know which branch to merge into, please input[default is $develop]:"
git --no-pagger branch
read temp
if [[ -z $temp ]]; then
father=$develop
else
father=$temp
fi
fi
echo "You are in branch || $currentBranch ||"
echo "Do you want to close it like this?"
gggttt;echo "git rebase \"$currentBranch\""
gggttt;echo "git checkout \"$father\""
gggttt;echo "git reset --hard \"$currentBranch\""
gggttt;echo "git branch -d \"$currentBranch\""
echo "press ENTER to continue, press Ctrl+c to ESCAPE"
read temp
git rebase "$currentBranch" && git checkout "$father" && git reset --hard "$currentBranch"\
&& echo "press Enter to delete $currentBranch branch"\
&& echo " press Ctrl+c not to delete it"\
&& read temp && git branch -d "$currentBranch"