push
$
npx mdskill add openai/symphony/pushPush branch changes to origin and manage pull requests automatically when publishing updates.
- Helps with safely publishing code changes and maintaining pull requests for collaboration.
- Integrates with GitHub CLI and depends on local validation tools like make.
- Decides actions based on remote state, push success, and existing pull request status.
- Surfaces errors for auth or workflow issues and updates pull requests as needed.
SKILL.md
.github/skills/pushView on GitHub ↗
---
name: push
description:
Push current branch changes to origin and create or update the corresponding
pull request; use when asked to push, publish updates, or create pull request.
---
# Push
## Prerequisites
- `gh` CLI is installed and available in `PATH`.
- `gh auth status` succeeds for GitHub operations in this repo.
## Goals
- Push current branch changes to `origin` safely.
- Create a PR if none exists for the branch, otherwise update the existing PR.
- Keep branch history clean when remote has moved.
## Related Skills
- `pull`: use this when push is rejected or sync is not clean (non-fast-forward,
merge conflict risk, or stale branch).
## Steps
1. Identify current branch and confirm remote state.
2. Run local validation (`make -C elixir all`) before pushing.
3. Push branch to `origin` with upstream tracking if needed, using whatever
remote URL is already configured.
4. If push is not clean/rejected:
- If the failure is a non-fast-forward or sync problem, run the `pull`
skill to merge `origin/main`, resolve conflicts, and rerun validation.
- Push again; use `--force-with-lease` only when history was rewritten.
- If the failure is due to auth, permissions, or workflow restrictions on
the configured remote, stop and surface the exact error instead of
rewriting remotes or switching protocols as a workaround.
5. Ensure a PR exists for the branch:
- If no PR exists, create one.
- If a PR exists and is open, update it.
- If branch is tied to a closed/merged PR, create a new branch + PR.
- Write a proper PR title that clearly describes the change outcome
- For branch updates, explicitly reconsider whether current PR title still
matches the latest scope; update it if it no longer does.
6. Write/update PR body explicitly using `.github/pull_request_template.md`:
- Fill every section with concrete content for this change.
- Replace all placeholder comments (`<!-- ... -->`).
- Keep bullets/checkboxes where template expects them.
- If PR already exists, refresh body content so it reflects the total PR
scope (all intended work on the branch), not just the newest commits,
including newly added work, removed work, or changed approach.
- Do not reuse stale description text from earlier iterations.
7. Validate PR body with `mix pr_body.check` and fix all reported issues.
8. Reply with the PR URL from `gh pr view`.
## Commands
```sh
# Identify branch
branch=$(git branch --show-current)
# Minimal validation gate
make -C elixir all
# Initial push: respect the current origin remote.
git push -u origin HEAD
# If that failed because the remote moved, use the pull skill. After
# pull-skill resolution and re-validation, retry the normal push:
git push -u origin HEAD
# If the configured remote rejects the push for auth, permissions, or workflow
# restrictions, stop and surface the exact error.
# Only if history was rewritten locally:
git push --force-with-lease origin HEAD
# Ensure a PR exists (create only if missing)
pr_state=$(gh pr view --json state -q .state 2>/dev/null || true)
if [ "$pr_state" = "MERGED" ] || [ "$pr_state" = "CLOSED" ]; then
echo "Current branch is tied to a closed PR; create a new branch + PR." >&2
exit 1
fi
# Write a clear, human-friendly title that summarizes the shipped change.
pr_title="<clear PR title written for this change>"
if [ -z "$pr_state" ]; then
gh pr create --title "$pr_title"
else
# Reconsider title on every branch update; edit if scope shifted.
gh pr edit --title "$pr_title"
fi
# Write/edit PR body to match .github/pull_request_template.md before validation.
# Example workflow:
# 1) open the template and draft body content for this PR
# 2) gh pr edit --body-file /tmp/pr_body.md
# 3) for branch updates, re-check that title/body still match current diff
tmp_pr_body=$(mktemp)
gh pr view --json body -q .body > "$tmp_pr_body"
(cd elixir && mix pr_body.check --file "$tmp_pr_body")
rm -f "$tmp_pr_body"
# Show PR URL for the reply
gh pr view --json url -q .url
```
## Notes
- Do not use `--force`; only use `--force-with-lease` as the last resort.
- Distinguish sync problems from remote auth/permission problems:
- Use the `pull` skill for non-fast-forward or stale-branch issues.
- Surface auth, permissions, or workflow restrictions directly instead of
changing remotes or protocols.
More from openai/symphony
- commit- Produce a commit that reflects the actual code changes and the session context. - Follow common git conventions (type prefix, short subject, wrapped body). - Include both summary and rationale in the body.
- debug- Find why a run is stuck, retrying, or failing. - Correlate Linear issue identity to a Codex session quickly. - Read the right logs in the right order to isolate root cause.
- land- Ensure the PR is conflict-free with main. - Keep CI green and fix failures when they occur. - Squash-merge the PR once checks pass. - Do not yield to the user until the PR is merged; keep the watcher loop running unless blocked. - No need to delete remote branches after merge; the repo auto-deletes head branches.
- linear|
- pull1. Verify git status is clean or commit/stash changes before merging. 2. Ensure rerere is enabled locally: - `git config rerere.enabled true` - `git config rerere.autoupdate true` 3. Confirm remotes and branches: - Ensure the `origin` remote exists. - Ensure the current branch is the one to receive the merge. 4. Fetch latest refs: - `git fetch origin` 5. Sync the remote feature branch first: - `git pull --ff-only origin $(git branch --show-current)` - This pulls branch updates made remotely (for example, a GitHub auto-commit) before merging `origin/main`. 6. Merge in order: - Prefer `git -c merge.conflictstyle=zdiff3 merge origin/main` for clearer conflict context. 7. If conflicts appear, resolve them (see conflict guidance below), then: - `git add <files>` - `git commit` (or `git merge --continue` if the merge is paused) 8. Verify with project checks (follow repo policy in `AGENTS.md`). 9. Summarize the merge: - Call out the most challenging conflicts/files and how they were resolved. - Note any assumptions or follow-ups.