33.8 Git Branch Naming
20230905
A branch name should be kept short but descriptive with underscore
(_
) separating words rather than hyphen (-
). Either can be chosen
as a standard but I prefer the underscore which is often interpreted
as a space, and to distinguish it from command line arguments which
use the hyphen.
A common convention for naming branches is to begin with a token, then
a slash, then a descriptive name, like feat/search_bar
.
Common tokens include feat
(feature), wip
(work in progess),
bug
, new
, test
, dev
, doc
.
For a team working on a project, where each member is generally
responsible for different activities, it is highly recommended the
token be the user’s name, like kt/add_colour
. This naming scheme
makes it clear who is responsible for a particular branch, but should
not discourage others from contributing to that branch through pull
requests.
A final nuance for working as a team, where each branch is typically
associated with an issue, the issue number can be handy to have with
the branch. This the barnach name might become kt/132_add_colour
for
the branch where I am working on issue #132
from the github
Issues/Kanban.
The use of the slash can be problematic when URIs are added to the branch, resulting in the slash becoming ambiguous. Nonetheless, the use of slash is common and supported by some git tools.
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0
