Forked from adeekshith/.git-commit-template.txt
Last active
February 8, 2018 09:26
-
-
Save GMaissa/f008b2ffca417c09c7b8 to your computer and use it in GitHub Desktop.
Enforce good commit message practices across teams.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# |<---- Using a Maximum Of 50 Characters ---->| | |
# Explain why this change is being made | |
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| | |
# Provide links or keys to any relevant tickets, articles or other resources | |
# Example: Github issue #23 | |
# --- COMMIT END --- | |
# Type can be | |
# feat : new feature | |
# fix : bug fix | |
# wip : While working on a fix/feature | |
# refactor : refactoring production code | |
# style : formatting, missing semi colons, etc; no code change | |
# doc : changes to documentation | |
# test : adding or refactoring tests; no production code change | |
# uncat : uncategorized commit - will not be listed in changelog | |
# -------------------- | |
# Remember to | |
# Capitalize the subject line | |
# Use the imperative mood in the subject line | |
# Do not end the subject line with a period | |
# Separate subject from body with a blank line | |
# Use the body to explain what and why vs. how | |
# Can use multiple lines with "-" for bullet points in body | |
# -------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
test -n "$(grep -iE '^(feat|fix|docs|test|refactor|style|uncat|wip) *:' ${1})" || { | |
echo >&2 " | |
ERROR: Please prepend the commit type to your commit message (ex: 'feat: my commit message'). | |
Type can be | |
feat (new feature) | |
fix (bug fix) | |
wip (while working on a fix/feature) | |
refactor (refactoring production code) | |
style (formatting, missing semi colons, etc; no code change) | |
docs (changes to documentation) | |
test (adding or refactoring tests; no production code change) | |
uncat (uncategorized commit - will not be listed in changelog) | |
" | |
exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To apply the template, save the .git-commit-template.txt file to your local machine and use
To apply the git hook for commit message validation, copy the commit-msg file into your local air repository hooks directory (.git/hooks)