Git Naming Conventions…

Git Naming Conventions…
Photo by Ganapathy Kumar on Unsplash

It was not until recently that I found a good article about naming conventions. As I created more repositories and the complexity of my projects increased, I become much more cognizant of the importance of being organized. There are many different things that can be done to keep a project orderly but here are some specifics related to Git.

Branch Naming

The article that I found was by codingsight.com and their naming rules just make sense. Here are a few takeaways:

  1. For temporary branches, use a keyword at the beginning hat describes the type of work.
    • Bug Fix (bug)
    • Hot Fix (hot)
    • Feature Branch (feature)
    • Experimental Branch (experiment)
    • Work in Progress Branch (wip)
  2. If using Jira or other PMS, use a unique ID within the branch name.
  3. Use hyphen or slashes as separators. I should probably write more about the effect of using slashes but taht will be a different article.
  4. Use only lowercase
  5. Be consistent. Decide early if words are separated by hyphens but don’t mix in underscores or periods unless there is a logical pattern.
  6. Potentially include the authors name in the name
  7. For branches that will take a long time to develop, use a short descriptive name.

Here is an example format: <branch-type>_<author>_<branch-name>

Commit Messages

I don’t really write detailed commit messages. I think about it but I tend to keep all messages very short. Here are a few heuristics from a medium.com article that I do like:

  1. Keep the subject line under 50 characters long.
  2. Explanatory text should be written in the imperative verb form - Fix bug causing outage.
  3. The message should answer these questions:
    1. Why is this change necessary?
    2. How does this commit address the issue?
    3. What effects does this change have?
  4. To keep messages shorter then the PMS ID could be added. This is common when using JIRA.

  5. For larger projects, write a multiline commit message by typing git commit. This will open a command line editor. You can also set your default editor with this command git config --global core.editor nano. I actually like to use the command line method: git commit -m "Subject" -m "Description..."

Similar to the medium article, gitkraken.com has a nice article that largely supports the above suggestions.

This is a preview of Clap Button, a new feedback and analytics tools for Hydejack, built by yours truly. You can try it out on localhost for free, but it will be removed (together with this message) when building with JEKYLL_ENV=production. To use Clap Button on your site, get a subscription
and set clap_button: true in your config file.


This site is a modified version of Hydejack v9.1.4 created by Erin Wills.