-
-
Save mrmoneyc/d36945c18efc0c5904d2 to your computer and use it in GitHub Desktop.
Angular Commit Message Conventions git hook, so you got your commit prepared to with the messages they expect ;)
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/bash | |
# Angular Commit Message Conventions git hook | |
firstLine=`head -2 $1 | tail -1` | |
if [[ $firstLine == \#* ]]; then # Testing that the file starts with a comment, not yet a real commit ;) | |
echo '<type>(<scope/component>): <subject>' > .prepare-commit-msg-temp | |
echo '' >> .prepare-commit-msg-temp | |
echo '<body>' >> .prepare-commit-msg-temp | |
echo '' >> .prepare-commit-msg-temp | |
echo '<footer>' >> .prepare-commit-msg-temp | |
echo '# types: feat, fix, docs, style, refactor, test, chore(maintain)' >> .prepare-commit-msg-temp | |
echo '' >> .prepare-commit-msg-temp | |
echo " | |
# Example: | |
# feat(\$browser): onUrlChange event (popstate/hashchange/polling) | |
# Added new event to \$browser: | |
# - forward popstate event if available | |
# - forward hashchange event if popstate not available | |
# - do polling when neither popstate nor hashchange available | |
# Closes #392 | |
# Breaks \$browser.onHashChange, which was removed (use onUrlChange instead) | |
" >> .prepare-commit-msg-temp | |
{ cat .prepare-commit-msg-temp; cat $1; } > .prepare-commit-msg-temp2 | |
cat .prepare-commit-msg-temp2 > $1 | |
rm .prepare-commit-msg-temp .prepare-commit-msg-temp2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment