Handmade by Devvrat. All rights reserved.
I name a branch the same way I name the commit. The prefix is a Conventional Commits type. If you have an issue id, put it in the name. If you don't, skip it.
feat/123-add-new-residence-pagefeat is the type. 123 is the issue id. add-new-residence-page is the description. That name is 31 characters.
The prefix is the type you will put on the commit. Conventional Commits requires feat for a new feature and fix for a bug fix. Other types are allowed. I use the types from commitlint's conventional config:
feat, a new featurefix, a bug fixdocs, documentation onlystyle, formatting that does not change what the code doesrefactor, a code change that is not a fix and not a featureperf, a code change that makes the code fastertest, new tests, or a correction to existing testsbuild, the build system or dependenciesci, CI config and scriptschore, a change that does not touch src or test filesrevert, a revert of an earlier commitUse the short type from that list. A new feature is feat. A bug fix is fix. A hotfix is fix.
If you have an issue id, put it right after the prefix.
feat/123-add-new-residence-page
fix/456-login-validation
refactor/789-migrate-to-next-14If you don't have an issue id, skip it.
feat/add-new-residence-page
fix/login-validation
refactor/migrate-to-next-14The description does not repeat the type. The prefix already says fix.
The description is lowercase. A hyphen splits the words. The words state the change.
refactor/789-migrate-to-next-14Keep the branch name at 50 characters or fewer.
With an issue id:
feat/123-add-new-residence-page is 31 characters.fix/456-login-validation is 24 characters.refactor/789-migrate-to-next-14 is 31 characters.With no issue id:
feat/add-new-residence-page is 27 characters.fix/login-validation is 20 characters.refactor/migrate-to-next-14 is 27 characters.The branch and the commit share one type. Put the issue id in the name when you have one. Skip it when you don't.