Commit-editmsg //free\\ -
Add feature to display interesting text
As part of our ongoing effort to enhance code quality and collaboration efficiency, this commit aims to refine our approach to commit messages. A clear and descriptive commit message is essential for quickly understanding the changes made to the codebase, which in turn facilitates smoother collaboration among team members and aids in version control management. COMMIT-EDITMSG
#!/bin/sh MSG_FILE="$1" # Git passes .git/COMMIT_EDITMSG as $1 if ! head -1 "$MSG_FILE" | grep -qE "^(feat|fix|docs): "; then echo "ERROR: Commit message must follow Conventional Commits format" exit 1 fi Add feature to display interesting text As part
It acts as a buffer. Once you save and close the editor, Git reads the text from this file to finalize the commit. head -1 "$MSG_FILE" | grep -qE "^(feat|fix|docs): ";
In the daily life of a developer using Git, few things are as simultaneously ubiquitous and ignored as the COMMIT-EDITMSG file. It flashes on your screen for a few seconds, you type a line, save, and move on. But beneath this transient text file lies a powerful, flexible tool that can transform your team’s collaboration, automate tedious tasks, and even serve as a referee for code quality.
Now, every time you commit, COMMIT_EDITMSG will open with this skeleton pre-filled, ensuring your team never forgets to add a "type" or reference a ticket number.
You can use the --verbose flag to see your changes directly inside the COMMIT_EDITMSG file while you write: git commit -v Use code with caution. Copied to clipboard