This skill should be used when a slash command needs to push code to remote, or when autonomously deciding to "push changes", "push to remote", "push code", or "update the remote branch". Provides standardized push workflow including remote tracking, existing PR detection, and intelligent PR description updates.
Standardized workflow for pushing commits to remote with intelligent PR description management.
This workflow requires the following context:
If invoked by a slash command: This context is typically pre-computed and already present. Reference the existing context rather than re-running commands.
If invoked standalone: Gather the required context first:
git branch --show-current
git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null
gh pr view --json number,title,body,state 2>&1 || echo "No PR exists"
Maintain clean history by squashing multiple unpushed commits into one before pushing.
git log -1 --format=%Bgit rev-list @{upstream}..HEAD --count 2>/dev/null
origin/main or origin/mastergit reset --soft @{upstream} (or base branch if no upstream)git add .git commit -m "<saved commit message>"git push -u origin <branch-name>git pushReview whether a PR exists for this branch (from context or by running gh pr view).
If no PR exists, the workflow is complete.
If a PR exists, determine whether the description needs updating:
Update the PR description if:
Do NOT update for:
Default to NOT updating. Most pushes don't warrant a description change.
If an update is warranted, first check PR ownership:
author field from /gcp), otherwise fall back to: gh pr view --json author --jq '.author.login'jeffdt-k: proceed with the update directly.When proceeding with the update:
formatting-prs exists and apply its guidancegh pr edit <number> --body "..." to updateIf no update is needed, briefly confirm the PR description is still accurate.
-u on first push to set upstream tracking