Git/hacks: Difference between revisions

Don't merge, Rebase!: better describe the daily workflow as compared to the release cycle workflow for rebasing versus merging.
Line 159: Line 159:


==Good and Consistent commit messages==
==Good and Consistent commit messages==
You hopefully know what constitutes a [https://cbea.ms/git-commit/ good] [https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html commit message]. What about consistency? Say you need to add standard language to every commit message like
You hopefully know what constitutes a [https://cbea.ms/git-commit/ good] [https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html commit message].  
 
https://thoughtbot.com/blog/5-useful-tips-for-a-better-commit-message
 
===Seven Habits of Highly Effective People (committers) ===
# Separate subject from body with a blank line
# Limit the subject line to 50 characters
# Capitalize the subject line
# Do not end the subject line with a period
# Use the imperative mood in the subject line
# Wrap the body at 72 characters
# Use the body to explain what and why vs. how
 
===Keywords===
Start your subject with one of the "agreed" keywords for your project so you can easily see them in the [[Git/log]] to make [[RELEASE NOTES]] easy.
add|bug|chore|delete|doc|feat|fix|refactor|remove|style|test|update
 
===Boilerplate===
Say you need to add standard language to every commit message like
<tt>"This work  was performed for NASA GRC-ATF by WikiWorks per NASA Contract  NNC15BA02B."</tt>
<tt>"This work  was performed for NASA GRC-ATF by WikiWorks per NASA Contract  NNC15BA02B."</tt>


To consistently format your commit messages, use the configuration parameter <code>commit.template</code> which you can do with <code>git config</code>, or else in your ~/.gitconfig file. Here's my [[Git/commit.template|commit.template]]
To consistently format your commit messages, use the configuration parameter <code>commit.template</code> which you can do with <code>git config</code>, or else in your ~/.gitconfig file. Here's my [[Git/commit.template|commit.template]]


https://thoughtbot.com/blog/5-useful-tips-for-a-better-commit-message
===Commit Templates===
 
The GitLab project uses the concept of commit templates<ref>https://docs.gitlab.com/ee/user/project/merge_requests/commit_templates.html</ref>
The GitLab project uses the concept of commit templates<ref>https://docs.gitlab.com/ee/user/project/merge_requests/commit_templates.html</ref>