Git Hook with Husky

Coauthors in commit message

You can also use coauthors by utilizing git hooks at the commit stage. Unlike the existing syntax for co-authors, if you simply use coauthors: username, the prepare-commit-msg hook will convert it to the existing syntax.

How to use

Copy & Paste below script into .husky/prepare-commit-msg

.husky/prepare-commit-msg
npx coauthors

Just Commit. That's all 🎉

Add your Co-Author's username of GitHub at the end of the commit message. like coauthors: <Co-Author>, <Co-Author>...

git commit -m "feat: add some feature
 
coauthors: manudeli, 2-NOW(Whale)"

This git hook will convert commit message automatically like below

feat: add some feature
 
Co-authored-by: Jonghyeon Ko <61593290+manudeli@users.noreply.github.com>
Co-authored-by: Whale <71202076+2-NOW@users.noreply.github.com>