| description | Stage, commit changes with a safe, generated message |
|---|
Before committing, follow these steps in order:
-
Review local changes first: !
git status --short!git diff --stat!git diff --cached --stat -
Check branch and upstream (if any): Current branch: !
git branch --show-currentUpstream: !git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null || echo "(none)" -
Only sync if asked or clearly needed:
- If $ARGUMENTS includes
syncorrebase, or if upstream exists and we are behind, then:git fetch origin 2>/dev/null- Behind count: !
git rev-list --count HEAD..@{upstream} 2>/dev/null || echo "0" - If behind > 0, run
git pull --rebase origin <current-branch> - If there are conflicts, stop and notify me
- If $ARGUMENTS includes
-
Decide what to stage (avoid secrets and generated files):
- If $ARGUMENTS contains paths, stage only those paths.
- Otherwise, review untracked/modified files and stage deliberately.
- Prefer
git add -A <paths>overgit add .. - Never stage files that look like secrets (e.g.
.env,credentials.json, private keys).
-
Detect repo commit conventions (use when present): Commit template: !
git config --get commit.template 2>/dev/null || echo "(none)"- If a commit template or commitlint config exists, follow it.
- Conventional Commits are optional unless required by repo config.
-
Generate a commit message (if not provided):
- If I provided a message above or in $ARGUMENTS, use it.
- Otherwise, infer type from changes and write a concise subject (max 50 chars).
- Add a short body only when it clarifies why.
-
Commit with the chosen message.
$ARGUMENTS