Git Commit
Stage all changes and commit them with a concise conventional commit message.
Input
$ARGUMENTS
Instructions
1. Navigate to Repository Root
Before staging files, ensure you are at the repository root:
git rev-parse --show-toplevel
Change to this directory if not already there.
2. Stage All Changes
Important: Always run from the repository root to ensure all changes are included.
git add .
3. Review What Will Be Committed
Check the staged changes:
git diff --cached --stat
4. Create the Commit
Commit with a concise message following conventional commit guidelines.
Format: type: description (keep under 50 characters)
Common types:
feat: new featurefix: bug fixrefactor: code refactoringdocs: documentationstyle: formatting/styletest: testschore: maintenance
Style:
- Use imperative mood ("Fix bug" not "Fixed bug")
- Capitalize first word
- No period at end
- Be specific but brief
- Focus on WHAT and WHY, not HOW
Examples:
feat: add user login validationfix: resolve memory leak in parserrefactor: simplify authentication logic
5. Handle Pre-Commit Hook Failures
If pre-commit hooks fail:
- Read the error output to understand what failed
- Fix the underlying issues - do not bypass hooks
- Stage the fixes:
git add . - Commit again with the same message
NEVER use --no-verify or force a commit without resolving issues.
6. Verify Success
After committing, verify the commit was created:
git log -1 --oneline
Error Handling
- If there are no changes to commit, report this and exit gracefully
- If hooks fail repeatedly, stop and ask the user for guidance
- Never force commits or skip validation steps