Style guide to write git history

Kaleem - Sep 24 - - Dev Community

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).

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .