You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[suggestion] to add doc about git hook which would not depend upon 3-rd party tool #87
Hi. In my project we do use conventional commits, but we don't use husky or Yorkie, also we don't want to force people to use emojis in commits. However, personally, I like putting emojis into my commits and I want it to be automated. Therefore, I've added devmoji into my .git/hooks/ manually. Here is info on how I have this done. In the root of project, run:
cp .git/hooks/prepare-commit-msg.sample .git/hooks/prepare-commit-msg # note, it's important to copy this to make sure file is executableecho"#\!/bin/sh\n\nCOMMIT_MSG_FILE=\$1\nCOMMIT_MSG=\$(cat \$COMMIT_MSG_FILE)\n\necho \"\${COMMIT_MSG}\" | devmoji > \$1"> .git/hooks/prepare-commit-msg
Would be great to have this added to the README of the project. Thanks!
The resulting content of .git/hooks/prepare-commit-msg would be:
I'm guessing OP was running macOS. On Linux you need to use echo -e in order to enable interpolation of backslash escapes. Then their hook works great. Another good reason not to use Husky is it falls apart when you try and perform an interactive rebase and that's frustrating when you're right at the finish line.
Activity
folke commentedon Dec 9, 2020
Thank you for the suggestion!
I've added a link to this issue from the docs.
Fixed in 8f7b36a
vhscom commentedon Feb 5, 2022
I'm guessing OP was running macOS. On Linux you need to use
echo -ein order to enable interpolation of backslash escapes. Then their hook works great. Another good reason not to use Husky is it falls apart when you try and perform an interactive rebase and that's frustrating when you're right at the finish line.arantebw commentedon Feb 9, 2023
I agree with @vhscom, it will fail on Linux if
echodoes not have the-eoption. So,echo -e "#\!/bin/sh\n\nCOMMIT_MSG_FILE=\$1\nCOMMIT_MSG=\$(cat \$COMMIT_MSG_FILE)\n\necho \"\${COMMIT_MSG}\" | devmoji > \$1" > .git/hooks/prepare-commit-msg