Everybody that uses branches for Code Review (or Pull Request/ Merge Request) has to choose how to name that branch.
This script creates branch name based on commit message with "some" convention.
BTW it is also good to have any convention for branch names in your team (company).
Takes the last commit message and checkouts to new branch.
Some examples how the commit message is transformed to branch name
Commit message | Branch name | |
---|---|---|
"feat: #OLDM-324 create product endpoint" |
→ | "feat/OLDM-324/create-product-endpoint" |
"fix: fix email" |
→ | "fix/fix-email" |
"add new TODO" |
→ | "add-new-todo" |
Python have to be installed on your machine (unless somebody will rewrite tiny script to bash)
- Copy files
to_branch
andparsing.py
to your/usr/local/bin
folder - make it executable
chmod u+x /usr/local/bin/to_branch
- run
to_branch
in your repository