Writing a Git Message
The rules every BodhiTree commit message follows.
Commit message must have a Subject and a Body
Separate subject from the body with a blank line
Limit the subject line to 50 characters
Do not end the subject line with a period
Use the steps mentioned in the Writing subject line section.
Wrap the body at 72 characters
Use the body to explain what and why vs. how
Writing subject line
This a syntax of commit subject:
COMMIT_TYPE: IMPERATIVE MESSAGE
Commit Types are:
NEW
IMPROVE
FIX
DOC
RELEASE
TEST
Imperative message should start with following words with Capitalization as given:
Add
Update
Delete
Fix
Rename
Style
Test
A properly formed Git commit imperative message should always be able to complete the following sentence:
If applied, this imperative message will your imperative message here
Add emojis to your messages
Edit your .gitconfig file located in your home directory.
vi ~/.gitconfig
Paste the following lines and save:
[alias]
logg = log --oneline --graph --decorate
conflicts = diff --name-only --diff-filter=U
# git commit, add all and push, in one step.
cap = "!f() { git commit -e -m \"$@\"; }; f"
tagf = "!f() { git tag -e -a \"$1\" -m \"$2\"; }; f"
# initial commit
int = "!f() { git cap \"🎉 INITIAL: $@\"; }; f"
# new file
new = "!f() { git cap \"📦 NEW: $@\"; }; f"
# improved code
imp = "!f() { git cap \"👌 IMPROVE: $@\"; }; f"
# bug fixes
fix = "!f() { git cap \"🐛 FIX: $@\"; }; f"
# code release
rlz = "!f() { git cap \"🚀 RELEASE: $@\"; }; f"
# document created
doc = "!f() { git cap \"📖 DOC: $@\"; }; f"
# test cases written
tst = "!f() { git cap \"✅ TEST: $@\"; }; f"
# created new tag
tagg = "!f() { git tagf \"$1\" \"🔖 TAG: $2\"; }; f"
# merge code
mrg = "!f() { git cap \"🔀 MERGE: $@\"; }; f"
Use following commands to commit
If you wish to commit new changes, use the following command
git new "Imperative message"
If you wish to commit improved code changes, use the following command
git imp "Imperative message"
If you wish to commit any bug fixes, use the following command
git fix "Imperative message"
If you wish to commit a relese, use the following command
git rlz "Imperative message"
If you wish to commit a doc related changes, use the following command
git doc "Imperative message"
If you wish to commit test code related changes, use the following command
git tst "Imperative message"
If you want to see the list of subjects from commits, use the following command
git logg
Example of a good commit
This is how you should write a good commit message.
git imp "Update assignment's hide unhide code"
and press enter, It will open a text editor. Here you can write your full commit message as per example shown below.
👌 IMPROVE: Update assignment's hide unhide code
This commit fix the performance problem of hiding and unhiding assignment.
The page doesn't refresh after clicking the hide/unhide button.
Following things are done:
- Add asynchronous script to button UI
- Change the text status on the button