Commit And Push

Commit whatever is currently staged (if anything) and push. Use when the user says "commit and push", "ship it", or similar. Pushes even when there's nothing new to commit, so it also ships already-made local commits. Does not stage anything. For commit-only, use commit.

ProstDev 8fdfe06 1.2 KB Updated

File contents

Commit and Push

Commit the currently staged changes (if any), then push. Do not git add, do not stage untracked or unstaged files.

Steps

  1. git diff --cached --stat — check what's staged.
    • Something staged: commit it, following the message rules in the commit skill (type: summary, staged only, no -a).
    • Nothing staged: skip committing — do NOT stage anything. Continue to push anyway (there may be earlier local commits to ship).
  2. git push. If the branch has no upstream, git push -u origin HEAD.
  3. Report what happened: the commit hash + message if one was made (or "nothing to commit"), and the push result — including "already up to date" if nothing was pushed.

Don't

  • Don't stage anything (git add, git commit -a, git commit <path>).
  • Don't amend, rebase, or force-push.
  • Don't touch other branches or open a PR.

ProstDev/skills/tree/main/.claude/skills/commit-and-push commit 8fdfe065e5

Frequently asked questions

npx skillmds@latest add prostdev/commit-and-push