DEV Community

Cover image for Style guide to write git history
Kaleem for This is Learning

Posted on

18 1 1 1 1

Style guide to write git history

A simple style guide to write maintainable git history.

Commits guide

Feat

Use the feat prefix for feature-related changes.

feat: add support for purchase order

Chore

Use the chore prefix for non-feature-related changes.

chore: rename product rental file

Refactor

Use the refactor prefix for refactoring changes.

refactor: file improvements for product rent section

Deploy

Use the deploy prefix for deployment-related changes.

deploy: trigger deployment

Docs

Use the docs prefix for documentation-related changes.

docs: update starting guide

Fix

Use the fix prefix for bug fixes or error corrections.

fix: resolve issue with user a glitching on login

Branches guide

For large features, divide your branch into smaller modules and use suffixes to continue changes.

feat/product-purchase-1

feat/product-purchase-2

feat/product-purchase-3

feat/product-purchase-4

If product purchase is a big module then you can use suffix numbers.

You will make changes in product-purchase-1, merge it in the major branch, and then start with product-purchase-2 from the major branch.

General guide

  • Create PRs for your changes; do not push directly to the major branch.

  • Be consistent with your approach of naming branches and commits.

  • Use present tense for commit messages: feat: add products for rental section instead of feat: added products for rental section.

  • In your PR, each commit should relate to an specific change, rather than combining multiple changes into one large commit.

  • For branches, use "/" slash notation e.g feat/product-purchase-1 for commits use ":" colon notation e.g chore: rename product rental file.

  • Utilize squash merges whenever appropriate (combines all commits into a single commit upon merging).

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (7)

Collapse
 
jimmymcbride profile image
Jimmy McBride β€’

What about doing every commit as "init commit"? ;P Just kidding! I really liked this article, and some of these rules I already follow, but not others. I think I'm going to make these rules standard in my gitflow now. Thanks for the great article!

Collapse
 
kaleemniz profile image
Kaleem β€’

I am glad you found it helpful. Using the guide I am sure you will find your way out with your specific needs/changes, add a thing or two, that is the point of it, keeping it simple is key when creating a guide, a guide not containing "everything" :)

Collapse
 
feketegy profile image
George β€’

I just use "final final - updates made to files"

Collapse
 
kaleemniz profile image
Kaleem β€’ β€’ Edited

I think "final final - updates made to files" could work let's say fixing a bug you attempt with unstructured commits and when you are done do a squash merge.

Collapse
 
kspshnik profile image
Evgeny Karpel β€’

I also use [Setup] for scaffolding stuff or setup files, and [Final] to PR "production-ready" (in some, probably limited, sence) code from dev to master

Collapse
 
zack-123 profile image
Zack β€’

Nice one! Thanks!

Collapse
 
kaleemniz profile image
Kaleem β€’

Thank you.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay