Conventional Branch" is a tool designed to help standardize branch names in Git for teams working on large projects. The extension allows you to choose from several pre-defined templates, which can be customized to suit your team's specific needs. Once a template is selected, you can easily create new branches with standardized names directly from your IDE. This helps to avoid confusion and promote consistency in branch naming conventions across the team. With "Conventional Branch", you can spend less time thinking about branch names and more time focusing on your work.
You can access VSCode Conventional Branch by using
Command + Shift + P
or Ctrl + Shift + P
, enter Conventional Branch
, and press Enter.
Got to User Settings > Conventionl Branch > format
You can change the default format and keep in mind that these are reserved keywords in this template: Branch
, TicketNumber
and Type
.
Examples of templates:
{Author}/{Type}/JIRA-{TicketNumber}/{Branch}
myGithubUserName/Trello-{IssueNumber}/{Branch}
{Type}/{Branch}
In .vscode > settings.json you can use conventional branch settings.
{
"conventional-branch.format": "{Author}/{Type}/JIRA-{TicketNumber}/{Branch}",
"conventional-branch.type": ["feature", "fix", "hotfix"],
"conventional-branch.branchNameSeparator": "-",
"conventional-branch.maxBranchNameLength": 50,
"conventional-branch.minBranchNameLength": 5,
"conventional-branch.forceBranchNameLowerCase": true,
"conventional-branch.removeBranchNameWhiteSpace": true
}
Base thing we are using is a format which is by default:
{Type}/{TicketNumber}/{Branch}
Type
is a special name. It is an enum that contains different types of branch like feat
, bug
and some other options(you can change it via settings).
Branch
is also something special. It is the branch name. By default some operations are enabled for branch name. For example we are removing the whitespaces. Or we are converting the text to lower case. These are customaizable options.
Sometimes you want to be sure that every branch you are making with the extension are from specific parent. For example staging
branch.
For this you can use this setting: forcedParentBranch
:
{
"conventional-branch.forcedParentBranch": 'staging'
}
Property | Description | Default Value |
---|---|---|
conventional-branch.type | An array that contains different type of branches. | ["feature","fix","hotfix","test","release"] |
conventional-branch.branchNameSeparator | Branch string must be separated by something. It could be space, dash or anything. | "-" |
conventional-branch.maxBranchNameLength | Set a maximum lenght for the branch name. | 50 |
conventional-branch.forceBranchNameLowerCase | A boolean that converts branch name to lower case | true |
conventional-branch.removeBranchNameWhiteSpace | Removes whitespaces from branch. | true |
conventional-branch.format | Format for creating branch. | "{Type}/{TicketNumber}/{Branch}" |
conventional-branch.minBranchNameLength | Minimum lengh for branch name. | 3 |
conventional-branch.forcedParentBranch | Force Branches to be created from this specific branch | null |