File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ get-def-branch() {
3
3
echo master
4
4
}
5
5
6
+ function get-tracking-branch() {
7
+ git config branch.$(git_current_branch).remote
8
+ }
9
+
6
10
are-you-sure() {
7
11
echo "๐พ Are you sureโ (type 'y' to confirm)"
8
12
read squashed
@@ -15,6 +19,21 @@ are-you-sure() {
15
19
fi
16
20
}
17
21
22
+ function check-upstream-branch() {
23
+ local upstream_branch=$(get-tracking-branch)
24
+ local feature_branch=$(git_current_branch)
25
+
26
+ if [ -z "$upstream_branch" ]; then
27
+ echo "===> ๐ No upstream branch detected for : '๐ $feature_branch'"
28
+ are-you-sure
29
+ if [ $? -ne 0 ]; then
30
+ return 1
31
+ fi
32
+ fi
33
+
34
+ return 0
35
+ }
36
+
18
37
startfeat() {
19
38
if [[ -n $1 ]]; then
20
39
echo "===> ๐ START FEATURE: '๐ $1'"
@@ -31,6 +50,11 @@ endfeat() {
31
50
return 1
32
51
fi
33
52
53
+ check-upstream-branch
54
+ if [ $? -ne 0 ]; then
55
+ return 1
56
+ fi
57
+
34
58
local feature_branch=$(git_current_branch)
35
59
local default_branch=$(get-def-branch)
36
60
You canโt perform that action at this time.
0 commit comments