Git Commit Message Format
Collect inputs
- •Ask for
typeanddescriptionif any are missing. - •Enforce
typeas one of:feat,fix,chore,doc,refactor,test,ci,revert. - •
issue-numberis optional. Include it only if the user explicitly asks for it or already provided it. Do not ask the user for an issue number. - •Ensure
descriptionis short and one line.
Construct message
- •If
issue-numberis provided, build:<type>: <issue-number> <description>. - •If
issue-numberis not provided, build:<type>: <description>. - •Echo the full message back for confirmation before running a commit.
Run commit (only if asked)
- •If the user asks to execute the commit, run
git commit -m "<message>"in the repo. - •If staged changes are unclear, offer to show
git statusbefore committing.