Prompt file imported from SergioArroni/SergioArroni.github.io (
.github/prompts/commit.prompt.md). Fill in{{input}}before use. Copyright stays with the author.
Git Commit & Push
Perform the full git commit and push workflow for the current workspace.
Steps
-
Stage changes: Run
git add -Ato stage all changes. If the user specifies particular files, stage only those. -
Review staged changes: Run
git diff --cached --statandgit diff --cachedto understand what's being committed. If there are no staged changes, inform the user and stop. -
Validate before commit:
- If
.pre-commit-config.yamlexists, runpython -m pre_commit run --all-files. - If there are obvious validation commands relevant to the changed files, run them too.
- If validation fails, stop before commit, show the errors, and fix them if the failure is straightforward and directly related to the staged changes.
- Do not commit while validation is red.
- If
-
Generate a conventional commit message based on the diff:
- Format:
<type>(<scope>): <descripción> - Types:
feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert - Scope: infer from the changed files (optional but preferred)
- Description: concise, imperative mood, lowercase, no trailing period
- Body: if changes are complex, add a body after a blank line explaining the "why"
- Breaking changes: add
BREAKING CHANGE:footer if applicable - First line must be under 72 characters
- IMPORTANT: Always write the description and body in Spanish
- Format:
-
Show the commit message to the user and proceed.
-
Commit: Run
git commitwith the generated message. Pre-commit hooks will execute automatically if configured in the repo. -
Handle pre-commit failures: If hooks fail, show the errors and stop. Do not bypass hooks unless the user explicitly asks.
-
Push:
- If the user specifies a target branch →
git push origin <branch> - Otherwise →
git push origin HEAD(current branch) - If the upstream is not set →
git push --set-upstream origin <branch> - Never force push unless explicitly requested.
- If the user specifies a target branch →
User Input
{{input}}