To automatically add emojis to your commits, you can use the commit-msg
hook.
$ git init
$ ln -s commit-msg-emoji .git/hooks/commit-msg
#!/bin/sh | |
# the file where the commit message is written | |
filepath="$1" | |
tmp_file=$(mktemp /tmp/emoji-commitzen.XXXX) | |
replacements=( | |
's/^feat/β¨ feat/' | |
's/^fix/π fix/' | |
's/^doc/π doc/' | |
's/^style/π¨ style/' | |
's/^refactor/π¨ refactor/' | |
's/^perf/π perf/' | |
's/^chore/π§ chore/' | |
's/^lint/π lint/' | |
's/^test/π¨ test/' | |
's/^first/π£ first/' | |
) | |
# join replacements by ; to have sed perform multiple replace | |
sed_command=$(printf "%s;" "${replacements[@]}") | |
# perform replacements in temp file | |
cat $filepath | sed "$sed_command" > $tmp_file | |
# replace commit file | |
mv $tmp_file $filepath |
how it work on windows?