33.8 Git Branch Naming

20231228

A branch name should be kept short but descriptive with underscore (_) separating words rather than hyphen (-). Either can be chosen as a standard the underscore is often interpreted as a space, and to distinguish it from command line arguments which use the hyphen.

For a team the prefered naming scheme is the initials of the team member who created the branch, a slash, the issue number associated with the branch, and then a brief description.

kt/34_support_csv

A widely used 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 initials, like kt/add_colour. This naming scheme makes it clear who is responsible for a particular branch, but should not be seen as 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. Thus the branch name might become kt/132_add_colour for the branch working on issue #132.

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