git_new_feature
This function will create and switch to a new feature branch with the given name.
The optional second parameter is the start point (main
if not given) for the feature branch.
The optional third parameter is the upstream (origin
if not given) for the feature branch.
The created feature branch will be pushed to the upstream if possible. |
Set the following Git configuration variables on your repository if you want to use a rebase workflow:
Or set it globally:
More Information: |
Usage
$ git_new_feature issue-1
$ git branch -vv
* issue-1 5a669af [origin/issue-1] initial
main 5a669af [origin/main] initial
$ git log --oneline
5a669af (HEAD -> issue-1, origin/main, origin/issue-1, main) initial
$ touch work
$ git add work
$ git commit --quiet -m work
$ git push --quiet
$ git log --oneline
2baf87f (HEAD -> issue-1, origin/issue-1) work
5a669af (origin/main, main) initial
$ git_new_feature stacked issue-1
$ git branch -vv
issue-1 2baf87f [origin/issue-1] work
main 5a669af [origin/main] initial
* stacked 2baf87f [origin/stacked] work
$ git log --oneline
2baf87f (HEAD -> stacked, origin/stacked, origin/issue-1, issue-1) work
5a669af (origin/main, main) initial
$ git_new_feature issue-2 main upstream
$ git branch -vv
* issue-2 5a669af [upstream/another] initial
issue-1 2baf87f [origin/issue-1] work
main 5a669af [origin/main] initial
stacked 2baf87f [origin/stacked] work
$ git log --oneline
5a669af (HEAD -> another, upstream/another, origin/main, main) initial