I found an answer to my question. In case it may help somebody...
I just created a commit-msg
file in .git/hooks
containing
#!/bin/sh
test -n "$(grep 'app.asana.com/' ${1})" || {
echo >&2 "ERROR: Commit message is missing Asana's task link.\n\nPlease append the Asana's task link relative to this commit into the commit message."
exit 1
}
Each user needs to have a commit-msg
file inside .git/hooks
. Then, as a solution, I added commit-msg
to the project folder (so I can pull this) with another file called commit-msg-hook.sh
containing:
#!/bin/sh
cp commit-msg .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg
echo "\nThe commit-msg hook was added to git hooks"
I welcome any advice to improve what I've done. Thanks.