Skip to content

Commit d3772eb

Browse files
committed
feat(feature): checkout from start point if exists
1 parent 41732e4 commit d3772eb

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

bin/git-feature

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ do
3232
--squash )
3333
merge_mode="--squash"
3434
;;
35+
--from )
36+
start_point=$2
37+
shift
38+
;;
3539
* )
3640
argv+=($1)
3741
;;
@@ -55,10 +59,24 @@ else
5559
else
5660
branch="$branch_prefix"/"${argv[0]}"
5761
fi
58-
if [[ -n $remote ]]
62+
63+
if [[ -n $remote ]] && [[ -z $start_point ]]
5964
then
6065
git create-branch -r $remote $branch
61-
else
66+
fi
67+
68+
if [[ -z $remote ]] && [[ -z $start_point ]]
69+
then
6270
git create-branch $branch
6371
fi
72+
73+
if [[ -n $remote ]] && [[ -n $start_point ]]
74+
then
75+
git create-branch -r $remote --from $start_point $branch
76+
fi
77+
78+
if [[ -z $remote ]] && [[ -n $start_point ]]
79+
then
80+
git create-branch --from $start_point $branch
81+
fi
6482
fi

0 commit comments

Comments
 (0)