Two shortcuts for new git branches
Functional aliases to create new branches, with naming conventions and validation
Option 1:
For one project at work we create new branches off of our master develop and support branches, with a specific naming convention. It’s a bit long to type repeatedly during the day, so I created some aliases that perform functions to streamline the process. Add the following to your .bash_profile or your .zshsrc file:
To use, gnbf <ticket number or description>
, and you’ll be switched to your new branch: feature/<yourname>/<yyyy-mm-dd>/<ticket number or description>
Option 2:
On another project, we use a more complex branch naming convention so we needed more variables. The following is a function that directs the user through the branch naming, and uses validation to make sure all the branch names are consistent: