Writing Commits
Before you finish a feature
, bug
, hotfix
or release
you need to write a good commit. The commit needs to be clear and contains all the details written in English.
All commits must contain:
Title - The title need to follow the same approach from
feature
, ex<TYPE>[(SCROPE)]: <JIRA-KEY> <TITLE>
in a real world examplefix(cart): DEN-100 cart page
orrefactor(cart): DEN-100 add to cart button on product view
Body - The body is an extended message to explain What and Why:
Add your message
Fix your message
Remove your massage
Change your massage
Refactor your massage
Release your message
So the complete commit need to be something like:
fix(cart): JIRA-123 minor changes on the cart page
add icon to the checkout button
change the background color for checkout button
remove coupon input, will not be used anymore
see also JIRA-456, JIRA-789
Types
Below is a list of supported types:
feat
: A new featurefix
: A bug fixdocs
: Documentation only changesstyle
: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)refactor
: A code change that neither fixes a bug nor adds a featureperf
: A code change that improves performancetest
: Adding missing or correcting existing testschore
: Changes to the build process or auxiliary tools and libraries such as documentation generationrevert
: Revert to a commit
Follow the conventional commits guide. See how big commerce validate-commits in their projects.
A Commit Template
<type>[optional scope]: <issue-key> <description>
[optional body]
[optional footer(s)]
# ** TYPES **
# feat (new feature)
# fix (bug fix)
# docs (changes to documentation)
# style (formatting, missing semi colons, etc; no code change)
# refactor (refactoring production/functional code)
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)
# revert (revert a commit)
#
# ** FOOTERS **
# References #1, #4, and #2.
# Fix #1. note this marks the item as accepted
# Closes #1 and #2. note this marks the item as accepted
Remember to remove placeholders once your commit message its ready (including types and footer references).
Adding the Commit Template to Git global config
To add the commit template to your git config, first create a gitmessage.txt
file and paste the commit template, once saved you can remove the .txt
extension (optional) then place the file in the following directory for Windows users: C:\Users\username
and Mac users: /Users/username
and run the following git command.
git config --global commit.template ~/.gitmessage.txt
Filename must have a .
at the beginning, ex. .git_template
.
Interested to join the team?
Learn more about our recruitment process and open positions.