diff --git a/bin/git-create-branch b/bin/git-create-branch
index c0d1dd4..6e27c0c 100755
--- a/bin/git-create-branch
+++ b/bin/git-create-branch
@@ -20,6 +20,12 @@ do
REMOTE=origin
fi
;;
+ --from)
+ if [[ -n $2 ]]; then
+ START_POINT=$2
+ shift
+ fi
+ ;;
*)
BRANCH=$1
esac
@@ -44,9 +50,15 @@ then
rm -f "$stderr"
if [ $REMOTE_EXIT -eq 0 ]
then
- git push $REMOTE HEAD:refs/heads/$BRANCH
- git fetch $REMOTE
- git checkout --track -b $BRANCH $REMOTE/$BRANCH
+ if [[ -n $START_POINT ]]; then
+ git fetch $REMOTE
+ git checkout --track -b $BRANCH $START_POINT
+ git push $REMOTE HEAD:refs/heads/$BRANCH
+ else
+ git push $REMOTE HEAD:refs/heads/$BRANCH
+ git fetch $REMOTE
+ git checkout --track -b $BRANCH $REMOTE/$BRANCH
+ fi
exit $?
else
echo
@@ -56,4 +68,9 @@ then
fi
fi
-git checkout -b $BRANCH
+if [[ -n $START_POINT ]]
+then
+ git checkout -b $BRANCH $START_POINT
+else
+ git checkout -b $BRANCH
+fi
diff --git a/bin/git-feature b/bin/git-feature
index 8712008..3a5e0ce 100755
--- a/bin/git-feature
+++ b/bin/git-feature
@@ -32,6 +32,10 @@ do
--squash )
merge_mode="--squash"
;;
+ --from )
+ start_point=$2
+ shift
+ ;;
* )
argv+=($1)
;;
@@ -55,10 +59,24 @@ else
else
branch="$branch_prefix"/"${argv[0]}"
fi
- if [[ -n $remote ]]
+
+ if [[ -n $remote ]] && [[ -z $start_point ]]
then
git create-branch -r $remote $branch
- else
+ fi
+
+ if [[ -z $remote ]] && [[ -z $start_point ]]
+ then
git create-branch $branch
fi
+
+ if [[ -n $remote ]] && [[ -n $start_point ]]
+ then
+ git create-branch -r $remote --from $start_point $branch
+ fi
+
+ if [[ -z $remote ]] && [[ -n $start_point ]]
+ then
+ git create-branch --from $start_point $branch
+ fi
fi
diff --git a/man/git-create-branch.1 b/man/git-create-branch.1
index 2dd8c5b..4e1e242 100644
--- a/man/git-create-branch.1
+++ b/man/git-create-branch.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "GIT\-CREATE\-BRANCH" "1" "June 2019" "" "Git Extras"
+.TH "GIT\-CREATE\-BRANCH" "1" "November 2020" "" "Git Extras"
.
.SH "NAME"
\fBgit\-create\-branch\fR \- Create branches
@@ -19,6 +19,12 @@ Creates local branch named Setup a remote tracking branch using <--from [start_point]> Setup a start point when the branch created. If <branchname> The name of the branch to create. Written by Jonhnny Weslley <jw@jonhnnyweslley.net>
-Modified by Mark Pitman <mark.pitman@gmail.com>, Brian Murrell <btmurrell@gmail.com>. Written by Jonhnny Weslley <jw@jonhnnyweslley.net>
+Modified by Mark Pitman <mark.pitman@gmail.com>, Brian Murrell <btmurrell@gmail.com>. Setup a remote tracking branch using <--from [start_point]> Setup a start point when the branch created. If <finish> Merge and delete the feature branch.remote_name. If remote_name is not supplied, use origin by default.--from is not supplied, use the current branch by default.AUTHOR
-REPORTING BUGS
@@ -155,7 +159,7 @@ Modified by Mark Pitman <
+.
+.P
+Setup a start point when the branch created\. If \fB\-\-from\fR is not supplied, use the current branch by default\.
+.
+.P
remote_name. If remote_name is not supplied, use origin by default.--from is not supplied, use the current branch by default.
Written by Jesús Espino <jespinog@gmail.com>
-Modified by Mark Pitman <mark.pitman@gmail.com>
-Modified by Carlos Prado <carlos.prado@cpradog.com>
Written by Jesús Espino <jespinog@gmail.com>
+Modified by Mark Pitman <mark.pitman@gmail.com>
+Modified by Carlos Prado <carlos.prado@cpradog.com>