iamrare / git_branch_name

Git branch name ideas, naming conventions, and how to use git branch edit description

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Git branch name

This page has git branch name ideas that we've gathered. We welcome feedback.

Contents:

Git branch naming conventions

Git commit message

Use direct imperative text, akin to a git commit message, that says what the branch does when it's merged.

Examples:

  • add-login-button

  • fix-table-layout

  • optimize-page-speed

Benefits: easy to understand the purpose, easy for inter-team communications.

Emoji

Use a branch name with an emoji that's akin to an icon, colorful, and fun.

Examples:

  • 🙂login-button (a smiling face emoji means add a feature)

  • 🐛table-layout (a bug emoji means fix a bug)

  • 🐇page-speed (a rabbit emoji means optimize an area to make it faster)

Benefits: easy to skim visually, fun for casual participants, creative.

Issue number

Use a branch name with an issue number based on your issue tracker, for example your issue tracker has issue number 100 and your branch name could be "100-foo-bar".

Examples:

  • 100-add-login-button

  • 101-fix-table-layout

  • 102-optimize-page-speed

Benefits: easy to jump between the issue tracker and the branch name.

Version number

Use a branch name with a version number, for example a branch for version 1.0.0 could be "1.0.0-foo-bar".

Examples:

  • 1.0.0-add-login-button

  • 1.0.1-fix-table-layout

  • 1.1.0-optmize-page-speed

Benefits: easy to see version ranges, group them, and also delete them when the version is done.

Date-time stamp

Use a branch name with a date or time, for example a branch created on January 1 2020 could be "2020-01-01-foo-bar".

Examples:

  • 2020-01-01-add-login-button

  • 2020-01-02-fix-table-layout

  • 2020-01-03-optimze-page-speed

Benefits: easy to see time ranges, group them, and also expire them after enough time has passed.

Group name

Use a branch name with your own group names, for example authentication/authorization could use "aa", or user interface branch could use "ui", or optimization opportunities could use "oo".

Examples:

  • aa-login-button

  • ui-table-layout

  • oo-page-speed

Benefits: easy to cluster by subteam, for example a security team looks at "aa", a design team looks at "ui", and a performance team looks at "oo".

Workflow tag

Use a branch name with your own workflow tag name, for example work in progress could use the tag name "wip", or a branch ready for user acceptance testing could use the tag name "uat", or a temporarly research branch could start with the tag name "tmp".

Examples:

  • wip-login-button

  • uat-table-layout

  • tmp-page-speed

Benefits: easy to understand in terms of customer delivery planning, if the teams are able to update their branch names as the branches reach various stages of delivery.

Name tokenization

Kebab case or snake case or camel case

Use a branch name with kebab case which means dashes, or snake case which means underscores, or camel case which means use upper-case letters instead of a separator characters.

Examples:

  • add-login-button (kebab case)

  • fix_table_layout (snake case)

  • optimizePageSpeed (camel case)

Slash separator

Use a slash "/" to simulate a directory and subdirectory.

Examples:

  • features/login-button

  • fixes/table-layout

  • optmizations/page-speed

Benefits: if you use a git GUI client that treats a slash "/" as a directory separator, then you may enjoy this kind of organization.

Caveats: Git branch names do not use directories, and many git clients and sites ignore the slash. Branches are implemented as paths, so you cannot have a branch named "foo" and another branch named "foo/bar".

Git branch edit description

To add more information to a branch, we edit the branch description, for example to say the purpose of the branch, or contact information for the maintainers, or links to issue tracker items.

To edit a branch description:

git branch --edit-description

To see a branch description:

git config branch.<name>.description

To set a branch description to one line:

git config branch.<name>.description "This is an example description"

Git alias

To use a git alias, edit your git config file (such as ~/.gitconfig) and add these git aliases:

bd = !"git config branch.$(git rev-parse --abbrev-ref HEAD 2>/dev/null).description"
be = branch --edit-description

To set the current branch description:

git bd "This is an example branch"

To see the current branch description:

git bd

To edit the current branch description:

git be
(launches your editor)

See also

Our related repos:

Git branch organization:

Git alias ideas:

About

Git branch name ideas, naming conventions, and how to use git branch edit description