Skip to content

Instantly share code, notes, and snippets.

@zmrdltl
Forked from aemonge/prepare-commit-msg
Created September 4, 2022 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmrdltl/47faf75a84e2d001c17bf0cd0b31503a to your computer and use it in GitHub Desktop.
Save zmrdltl/47faf75a84e2d001c17bf0cd0b31503a 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 ;)
#!/bin/bash
firstLine=`head -2 $1 | tail -1`
if [[ $firstLine == \#* ]]; then # Testing that the file starts with a comment, not yet a real commit ;)
echo '<type>(<component>): <subject>' > .prepare-commit-msg-temp
echo '' >> .prepare-commit-msg-temp
echo '<body>' >> .prepare-commit-msg-temp
echo '' >> .prepare-commit-msg-temp
echo '# types: feat, fix, docs, style, refactor, test, chore(mantean)' >> .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
@zmrdltl
Copy link
Author

zmrdltl commented Sep 4, 2022

git hook임

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment