Created
July 3, 2024 15:28
-
-
Save KScaesar/aa03d78cee693fbd55258f32f9c033b9 to your computer and use it in GitHub Desktop.
check git commit-msg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| commit_msg_file=$1 | |
| commit_msg=$(cat "$commit_msg_file") | |
| date_regex="^[0-9]{4}-[0-9]{2}-[0-9]{2}" | |
| if ! echo "$commit_msg" | grep -qE "$date_regex"; then | |
| echo "Error: commit message must start with a date in YYYY-MM-DD format." | |
| exit 1 | |
| fi | |
| exit 0 |
Author
KScaesar
commented
Jul 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment