Git commits and git branch naming

ishimwe_ricky

Ishimwe Pierre Richard

Posted on June 20, 2023

Git commits and git branch naming

Image description
Branches

Category: The first thing to do when naming a branch in git, You have to give it a category. The following are the different categories of git naming.

Feature: Used for adding, refactoring, or removing a feature.
Bugfix: Used for fixing a bug.
Hotfix: Used for giving the codes a temporary solution. (Usually because of an emergency).
Test: Used for experimenting outside of a ticket.
Wip: For a work in progress.

Reference: The second thing to do is to give the branch a reference which begins with a “/” or “-” sign and then the reference. If there is no reference, just add “/no-ref”.
Using separators such as “category/no/ref” or “category-no-ref”, improve the readability, but remember to be consistent with the chosen sign.

Description: Depending on the sign you chose to go with between “/” and “-”, after the reference you put another sign, followed by a short description of your message. This description should be “Kebab-cased”, (meaning: a programming variable naming convention, where the space between words and any special character are replaced with a dash “-”).
Branch naming example:
For adding, refactoring, removing a feature use
git branch feature/issue-10/create-new-button

For fixing a bug use
Git branch bugfix/issue-20/signup-button-overlap

For fixing a bug really fast as a temporary solution use
Git branch hotfix/issue-30/login-button-not-working

For experimenting outside of an issue use
Git branch test/no-ref/refactor-login-component

Image description
Commits

Category: The first thing to do when naming a commit in git, You have to give it a category. The following are the different categories of commit naming.

Feat: Used for adding a new feature.
Fix: Used for fixing a bug.
Refactor: Used for changing the codes for performance
Chore: Used for everything else.

Description: After the category, the colon sign (:) is written to announce the commit description.

Statement: After the colon, a commit description follows in the form of a short statement describing the changes made. Statements are separated by a semi-colon (;).

Commit naming example: **
**Git commit -m”category: added new image; replaced old footer”

💖 💪 🙅 🚩
ishimwe_ricky
Ishimwe Pierre Richard

Posted on June 20, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related