Skip to main content
100%

A git hook that checks whether there is an issue number in the first line of your commit message

✓ Published0🌍 Public
Aalper
Last edited Jun 19, 2019
Created on Jun 19, 2019

This example demonstrates a Git hook that enforces commit message conventions by checking the first line for an issue number. It shows a Python script using the `sys` module to read the commit message file path passed as an argument. The script opens the file in read-write mode, reads all lines, and examines the first line for a `#` character, which indicates an issue reference. If no issue number is found, the script prints an error message and exits with a non-zero status code, blocking the commit. The code relies on standard Python file I/O and the `sys.argv` list to access command-line arguments, without external visualization libraries.

AI-generated description

Similar vizzes