分支推送与 PR 创建
push
将当前分支的变更推送到 origin,并创建或更新相应的拉取请求(pull request);当被要求推送、发布更新或创建拉取请求时使用。
- License 许可
- Apache-2.0
- 所属仓库
- openai/symphony
- 最近更新
- 2026-09-16
- Stars
- ★ 2.8w
- Forks
- 2.9k
01 前言 Front Matter
- 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.
03 SKILL.md 正文
Push
Prerequisites
ghCLI is installed and available inPATH.gh auth statussucceeds for GitHub operations in this repo.
Goals
- Push current branch changes to
originsafely. - 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
-
Identify current branch and confirm remote state.
-
Run local validation (
make -C elixir all) before pushing. -
Push branch to
originwith upstream tracking if needed, using whatever remote URL is already configured. -
If push is not clean/rejected:
- If the failure is a non-fast-forward or sync problem, run the
pullskill to mergeorigin/main, resolve conflicts, and rerun validation. - Push again; use
--force-with-leaseonly 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.
- If the failure is a non-fast-forward or sync problem, run the
-
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.
-
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.
-
Validate PR body with
mix pr_body.checkand fix all reported issues. -
Reply with the PR URL from
gh pr view.
Commands
# 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-leaseas the last resort. - Distinguish sync problems from remote auth/permission problems:
- Use the
pullskill for non-fast-forward or stale-branch issues. - Surface auth, permissions, or workflow restrictions directly instead of changing remotes or protocols.
- Use the
04 同仓库更多 Skills
Symphony 版本发布
release
通过提升已提交的版本号、将其落地、为合并后的提交打标签,并验证 Burrito 发布工作流,来创建一次 Symphony 发布。当被要求发布、打标签或重新打标签(retag)Symphony 时使用。
分支拉取与冲突解决
pull
将最新的 origin/main 拉取到当前本地分支并解决合并冲突(也称 update-branch)。当 Codex 需要将功能分支与 origin 同步、执行基于合并(merge)的更新(而非变基/rebase),并指导冲突解决的最佳实践时使用。
Linear GraphQL 操作
linear
使用 Symphony 的 `linear_graphql` 客户端工具执行原生的 Linear GraphQL 操作,例如评论编辑和上传流程。
PR 合并落地
land
通过监控冲突、解决冲突、等待检查,并在检查全部通过时进行 squash 合并来落地(land)PR;在被要求落地、合并或推动 PR 直至完成时使用。
运行故障日志排查
debug
通过结合 issue/session 标识符追踪 Symphony 和 Codex 日志,调查卡住的运行和执行失败;在运行停滞、反复重试或意外失败时使用。
Git 提交信息生成
commit
根据当前更改创建规范的 git commit,并利用会话历史提供提交理由与摘要;在被要求提交、准备提交信息或完成暂存工作时使用。