commit-msg.sample 913 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. #
  3. # This is an example Git hook for use with Rush. To enable this hook, rename this file
  4. # to "commit-msg" and then run "rush install", which will copy it from common/git-hooks
  5. # to the .git/hooks folder.
  6. #
  7. # TO LEARN MORE ABOUT GIT HOOKS
  8. #
  9. # The Git documentation is here: https://git-scm.com/docs/githooks
  10. # Some helpful resources: https://githooks.com
  11. #
  12. # ABOUT THIS EXAMPLE
  13. #
  14. # The commit-msg hook is called by "git commit" with one argument, the name of the file
  15. # that has the commit message. The hook should exit with non-zero status after issuing
  16. # an appropriate message if it wants to stop the commit. The hook is allowed to edit
  17. # the commit message file.
  18. # This example enforces that commit message should contain a minimum amount of
  19. # description text.
  20. if [ `cat $1 | wc -w` -lt 3 ]; then
  21. echo ""
  22. echo "Invalid commit message: The message must contain at least 3 words."
  23. exit 1
  24. fi