Situation
The implementation has been reviewed and accepted, and the developer now wants that exact state committed and pushed to a known destination.
Publication is a separate authority boundary. A completed milestone, green test suite, ready review verdict, or developer acceptance does not independently permit an agent to create commits, push branches, publish tags, deploy software, or send external messages.
Common mistake
Treating “ready” as “publish now” collapses engineering judgment and external action into one decision. The agent may push to an assumed remote, include unrelated work, publish uninspected commits, or expose a secret that was introduced and removed within local history.
Another mistake is reducing publication to a literal git push. Safe publication must establish what will be committed, which unpublished history will move, where it will go, and which repository policies govern the operation.
Agentic approach
Authorize one explicit publication outcome. The agent then carries the operational burden while preserving clear stopping conditions:
- Resolve the active branch and one exact remote destination.
- Inspect the complete worktree and unpublished history for scope, cohesion, and sensitive data.
- Reuse current readiness evidence only when it matches the exact state being published.
- Stage and commit the complete accepted state under repository policy when needed.
- Verify the created commit before any network action.
- Push one branch with one explicit refspec and report the result.
This workflow does not authorize deployment, release creation, tag publication, package publication, or another external action.
Before you send the prompt
Provide:
- the intended remote and destination branch
- the accepted task, plan, milestone, or review evidence
- any known unpublished commits that belong in the push
- any required repository-specific commit or signing policy
- confirmation that deployment and other external actions remain out of scope unless separately authorized
Do not issue this prompt while the repository is still under review or while findings remain unresolved.
Worked example
Suppose a reviewed documentation change is accepted on branch clarify_workflow and should enter origin/main. The worktree also contains an unrelated local draft, and the branch contains one earlier unpublished fix.
A safe publication workflow does not select only the documentation file or silently include the draft. It inspects the complete worktree, determines whether one cohesive new commit is possible, inspects the earlier unpublished fix as its own commit, and stops if the draft prevents the complete worktree from forming one honest commit. If the state is cohesive and clean, it creates the required signed commit, verifies its tree and parent, and pushes only clarify_workflow to the explicitly resolved destination.
What a good result contains
- one unambiguous active branch, remote, and destination branch
- complete inspection of uncommitted changes and unpublished commit history
- explicit sensitive-data and unresolved-finding checks
- exact repository commit, sign-off, signature, and hook policy compliance
- a staged tree that matches the accepted state
- a verified commit parent, tree, message, and changed path set
- one explicit branch refspec with no tag or multi-ref publication
- preserved local state and an exact retry point when the push fails
- a report of the commit-and-push or push-only path and its result
Useful follow-ups
When the destination is ambiguous:
Show the branch, upstream, push configuration, remotes, and candidate destinations. Do not stage, commit, or push until I identify one exact destination.
When the worktree is not cohesive:
Identify the unrelated change groups and explain why they cannot form one honest commit. Preserve every file and stop before staging.
When a push is rejected:
Preserve the local commit. Report its hash, the destination, and the rejection without merging, rebasing, resetting, amending, or forcing.
Warning signs
- the destination is inferred from a default branch name
- only the latest cumulative diff is inspected while earlier unpublished commit content is ignored
- untracked, deleted, renamed, or submodule changes are omitted
- a secret scan ignores content introduced and removed within unpublished history
- signing, sign-off, hooks, or verification are bypassed after failure
- an implicit push publishes tags or multiple refs
- a rejected push triggers force, rebase, amend, reset, or branch switching
- deployment or another external action is bundled into publication without authority
Developer review responsibility
Confirm that the destination and published commit range match the accepted change. Treat any retry after local state, remote state, or destination changes as a new publication decision. Keep deployment, release, package publication, and external communication under their own explicit authority boundaries.