Skip to content

rukavinaet/git-naming-conventions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Git Naming Conventions

In Git, branches are used to develop features, fix bugs, and experiment with new ideas independently of the main codebase. Using a consistent naming convention for branches can greatly enhance collaboration and project management. This article provides guidelines and best practices for naming Git branches.

Why Naming Conventions Matter?

Consistent branch naming conventions help in the following:

  • Making the purpose of a branch clear
  • Improving collaboration among team members
  • Automating workflows and CI/CD pipelines
  • Maintaining a clean and organized repository

Common Branch Naming Conventions

Here are some common naming conventions used in Git branches:

Feature Branches

Feature branches are used to develop new features. The best practice is to prefix the branch name with feature/:

feature/short-description
feature/login-page

Bugfix Branches

Bugfix branches are used to fix bugs. A common prefix is bugfix/ or fix/:

bugfix/issue-123
fix/null-pointer-exception

Hotfix Branches

Hotfix branches are used for urgent fixes in production. They often use the prefix hotfix/:

hotfix/critical-bug

Release Branches

Release branches are used to prepare for a new release. A common prefix is release/:

release/v1.2.0
release/2.0.0

Improvement Branches`

Improvement branches are used for enhancements and optimizations. A common prefix is improvement/:

improvement/refactor-auth
improvement/update-dependencies

Experimental Branches

Experimental branches are used to try out new ideas and experiments. A common prefix is experiment/:

experiment/new-layout
experiment/feature-toggle

Best Practices

  • Be Descriptive: Use descriptive names that convey the purpose of the branch.
  • Use Prefixes: Use prefixes like feature/, bugfix/, and release/ to categorize branches.
  • Use Hyphens: Separate words with hyphens for readability (e.g., feature/login-page).
  • Keep Names Short: Keep branch names concise but meaningful.
  • Include Issue Numbers: If applicable, include issue or ticket numbers (e.g., bugfix/issue-123).

Examples

Here are some examples of well-named Git branches:

feature/add-user-authentication
bugfix/fix-header-css
hotfix/security-vulnerability-patch
release/v1.3.0
improvement/refactor-database-layer
experiment/implement-new-ui