Add, Commit, and Push
Stage all changes, create a commit, and push to GitHub.
Steps
- •Run
git statusto review what will be committed. Never use the-uallflag. - •Run
git diffto see staged and unstaged changes. - •Run
git log --oneline -5to see recent commit message style. - •Show the user the list of files that will be added/committed and ask for confirmation before proceeding. If the user declines, stop.
- •If
$ARGUMENTSis provided, use it as the commit message. Otherwise, analyze the changes and generate a concise commit message that describes why the changes were made. - •Stage all changes:
bash
git add -A
- •Create the commit. Always end the message with the co-author line:
code
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- •Push to the current branch:
bash
git push origin $(git rev-parse --abbrev-ref HEAD)
- •If the push fails because the remote branch doesn't exist yet, push with
-u:bashgit push -u origin $(git rev-parse --abbrev-ref HEAD)
- •Report the result — show the commit hash and confirm the push succeeded.
Rules
- •Do NOT use
--forceor--no-verifyflags. - •Do NOT commit files that look like secrets (
.env, credentials, tokens). Warn the user if any are staged. - •If there are no changes to commit, tell the user and stop.
- •Always use a HEREDOC to pass the commit message to avoid quoting issues.