Skip to content

Git Related Rules

Junetrbl edited this page Oct 28, 2021 · 3 revisions

Commit Message Rule: Semantic Commit Messages

Format

<type>[optional scope]: <description>

Example

feat: add login feature
|--|  |----------------|
|     |
|     +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.

Other <types>:

  • feat: a commit of the type feat introduces a new feature to the codebase
  • fix: a commit of the type fix patches a bug in your codebase
  • docs: a commit of the type docs changes to the documentation
  • style: a commit of the type style changes formatting, missing semicolons, etc; no production code change
  • refactor: a commit of the type refactor refactors production code, eg. renaming a variable
  • test: a commit of the type test adds missing tests or refactors tests; no production code change
  • chore: a commit of the type chore updates grunt tasks etc; no production code change

References:

https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716

Git Flow

Feature Branch ⇒ Master Branch (QA) ⇒ Deploy Branch (PROD)

WorkFlow

  1. Create an issue with the name under this format.
feature/<work-to-do>
  1. Complete the description of the new issue.
❓ <AS-IS> What is this issue for?

⭐️ <TO_BE> With this branch, what will change?

Write the purpose of the creation of this branch and the expected change after merging this branch. This template is provided automatically.

  1. Create a feature branch from the master branch under this naming convention.
#<issue_no>_feature/<work-to-do>
  1. Do your job related to <work-to-do>
  2. Create a pull request and complete this template.
❓ <AS-IS> What is this PR for?

⭐️ <TO_BE> After merging this PR, what will change?

Write the purpose of the creation of this PR and the expected change after merging this PR. This template is provided automatically.

  1. Request a review from the teammates.
  2. After the approval, merge the feature branch to the master branch.
  3. Delete the feature branch that will not be used in the future. (Too many active branches might confuse you!)

Branch rule

Feature Branch

Use descriptive but simple branch names! 😅

Master Branch

  • Merge your feature branches into this branch.
  • Here, all the implemented features coalesce.
  • Do not commit your work directly to the master branch!

Deploy Branch

  • When the service becomes ready to be deployed, make a PR and merge from the master branch to the deploy branch.