Git Commit Msg
Overview
Generate a detailed commit message for HEAD without loading broad repository context, preview it, and amend the latest commit. Detect whether the original HEAD is already on upstream and force-push with --force-with-lease when required.
Workflow
- Ensure the repository is on a normal branch (not detached
HEAD). - Run:
scripts/amend_latest_commit_message.sh
- Review the message preview shown by the script.
- Confirm the amend prompt to update
HEAD.
Message Format
Generate a structured message with:
- A concise title line.
Summarysection.Files Changedsection grouped by Added, Modified, Deleted, and Renamed.Statssection using git shortstat output.Notessection documenting that the message was derived from latest commit metadata.
Options
Use optional flags when needed:
--yes: skip interactive confirmation.--no-push: never push, even when oldHEADwas on upstream.--max-files N: cap file entries shown per section (default10).
Safety and Token Efficiency
Keep analysis strictly to latest-commit metadata:
git diff-tree --name-statusfor file status classification.git show --shortstatfor compact statistics.
Do not scan the full repo or load large code context to generate the message.
Resources
scripts/amend_latest_commit_message.sh: Build preview message, amendHEAD, and force-push with--force-with-leasewhen needed.