Update Existing PR

VerifiedCaution

Update an existing pull request with new changes, sync with the base branch, and refresh the PR description.

Sby Skills Guide Bot
DevelopmentIntermediate
8/16/2026
Claude Code
#git#github#pull-request#rebase#cli

Recommended for

Automated summary

Updates an existing GitHub pull request by pushing follow-up commits and rewriting its title and description to reflect the whole branch.

Strengths

  • Runs pre-flight checks in order: gh authentication, an open PR for the current branch, a clean working tree, and synced submodules.
  • Syncs the branch with its base via fetch and rebase, falling back to --force-with-lease with clear guidance when the push is rejected.
  • Reviews every commit on the branch using a three-dot diff, not just the latest commit, before rewriting the PR description.
  • Surfaces rebase conflicts to the user with both sides shown instead of resolving them silently.

Limitations

  • Does not create PRs: when no PR exists for the branch it aborts and points to /create-pr.
  • Assumes the GitHub CLI is installed and authenticated and the branch is on a reachable origin; no support for GitLab, Bitbucket, or fork-based workflows.
  • Depends on companion skills (/commit, /create-pr) and requires human input to settle rebase conflicts.
  • The PR body-update section is only partially specified, so the final description format stays fairly open.
When to use it

Use it when a PR is already open and you need to push follow-up changes while refreshing its description.

When not to use it

Avoid it for opening a first PR, for touching a merged or closed PR, or on repositories not hosted on GitHub.

Security analysis

Caution
Quality score92/100

The skill uses powerful developer tools (git, gh) for a legitimate workflow: updating a PR. It includes safety checks like confirming clean git state, verifying PR state, and using --force-with-lease rather than --force. No destructive or exfiltrating commands are present, but force-push and rebase are inherently risky operations that warrant caution.

Findings
  • •Uses git rebase and git push --force-with-lease, which rewrite branch history and could overwrite others' work if misused.
  • •Instructs running network commands (gh api, gh pr edit) that modify remote repositories.
  • •Writes to /tmp and executes shell commands, requiring an agent with shell access.
How this analysis is made

Examples

Push follow-up work
Push my latest commits to the existing PR and update the description to cover everything on this branch.
Rebase and refresh
Sync my PR branch with main, rebase it, and refresh the PR title and body.
Stale description
The PR description is out of date — review all commits on this branch and rewrite it.

name: update-pr description: "Update an existing pull request with new changes. Use when the user wants to update a PR, push follow-up changes to a PR, refresh a PR description, or sync a PR with latest commits. Triggers on: update pr, update-pr, update the pr, push to pr, refresh pr, sync pr, update pull request."

PR Updater

Push follow-up changes to an existing PR and update its description to reflect the new work.


Workflow

Step 1: Pre-flight Checks

  1. Verify GitHub CLI authentication — run gh api user --jq '.login' to confirm the CLI is authenticated. If this fails, the user needs to run gh auth login first.
  2. Find the existing PR — run gh pr view --json number,title,body,url,baseRefName,state to find the PR for the current branch. If no PR exists, abort and suggest using /create-pr instead. Check the state field — if it is not OPEN, abort and inform the user that the PR is already merged or closed.
  3. Verify clean git state — run git status to ensure no uncommitted changes. If there are uncommitted changes, run the /commit skill first to commit them.
  4. Sync submodules — check if .gitmodules exists first. If it does, run git submodule update --init --recursive. If not, skip this step.

Step 2: Sync with Base Branch

Ensure the feature branch is up-to-date with the base branch to avoid merge conflicts:

  1. Fetch latest remote — run git fetch origin <base-branch> (use the base branch from the PR metadata)
  2. Check for divergence — run git log HEAD..origin/<base-branch> --oneline to see if the base branch has new commits
  3. Rebase if needed — if there are new commits on the base branch: a. Run git rebase origin/<base-branch> b. Resolve conflicts — if the rebase hits conflicts:
    • Read the conflicting files to understand both sides
    • Surface the conflict to the user — show both sides and ask which version to keep. Do not silently resolve conflicts.
    • Stage resolved files: git add <file>
    • Continue: git rebase --continue
    • Repeat until rebase completes
  4. Verify clean state — run git status to confirm no unresolved conflicts remain
  5. Push the branch — run git push. If the rebase changed history, use git push --force-with-lease instead. If --force-with-lease fails, it means someone else has pushed to this branch. Fetch the remote branch (git fetch origin <branch>), inspect the divergence (git log HEAD..origin/<branch> --oneline), and ask the user how to proceed — they may need to integrate the other contributor's changes first.

Step 3: Analyze New Changes

Understand the full scope of changes now in the PR:

  1. Run git log origin/<base-branch>..HEAD --oneline to see all commits on this branch
  2. Run git diff origin/<base-branch>...HEAD --stat for a high-level summary of changed files
  3. Run git diff origin/<base-branch>...HEAD to read the full diff. Note: Three-dot (...) syntax is intentional — it shows only the changes introduced on this branch since it diverged from the base, excluding commits on the base branch that aren't part of this PR.
  4. Identify the type of change: feat, fix, refactor, docs, chore, etc.
  5. Review existing PR title and body — compare the current PR title and body (from Step 1) against the full diff. Note what's already accurately described vs. what's missing, outdated, or no longer relevant.

Important: Look at ALL commits, not just the latest one. The updated PR description should reflect the entire branch, not just the new additions.

Step 4: Update the PR Description

Title

  • Under 70 characters
  • Use conventional prefix: feat:, fix:, refactor:, docs:, chore:
  • Review the existing PR title (from Step 1). If it still accurately reflects the full scope of changes, keep it. If the scope has changed or the title is misleading, update it.

Body

Review the existing PR body (from Step 1) and update it to reflect the current state of the branch. Preserve any still-accurate content (e.g., context, links, decisions) rather than rewriting from scratch. Use this template — scale detail with PR complexity:

## Summary
<1-5 bullet points explaining what changed and WHY — covering ALL changes in the branch>

## Changes
<Categorized list of what was modified — group by area/concern>

## Diagrams
<OPTIONAL — include Mermaid diagrams when visual aids clarify workflow or architecture changes>

## Test Plan
<How the changes were verified — manual testing steps, automated tests run, curl commands, etc.>

Guidelines for the body:

  • State the purpose clearly — explain why, not just what
  • Cover ALL changes in the branch, not just the latest commits
  • Provide context and background with links to relevant issues/docs
  • Include Mermaid diagrams when they simplify explanation of workflows or architecture
  • Keep PRs focused on a single concern — suggest splitting if the PR is too large
  • Before overwriting the PR body, compare the existing body against the standard template sections (Summary, Changes, Diagrams, Test Plan). Flag any sections or content that appear to have been manually added after PR creation (e.g., reviewer notes, deployment checklists, linked discussions) and ask the user whether to preserve them.
  • Do NOT include any "Generated with Claude Code" footer or bot attribution lines
  • Do NOT include Co-Authored-By lines

Step 5: Apply Updates

Write the body to a temp file and use --body-file to avoid shell argument length limits:

cat > /tmp/pr_body.md <<'EOF'
## Summary
...

## Changes
...

## Test Plan
...
EOF
gh pr edit --title "the pr title" --body-file /tmp/pr_body.md

Do NOT add:

  • --author flag
  • Any Co-Authored-By trailer
  • Any "Generated with Claude Code" footer

Draft/Ready handling: If the user wants to mark a draft PR as ready for review, run gh pr ready. If the user wants to convert to draft, run gh pr ready --undo.

Step 6: Report

  • Return the PR URL so the user can review it
  • Summarize what changed in the PR description compared to before
  • If gh pr edit fails, diagnose the error and suggest fixes

Best Practices Encoded

PR Size: Keep PRs small and focused. If the diff is very large (>500 lines changed), suggest splitting into smaller PRs.

Commit History: If the commit history is messy, suggest rebasing to clean it up. Clean commits that explain why make review much easier.

Feedback Requests: If the user mentions wanting specific feedback, add a "Feedback Requested" section to the body.

Screenshots: For frontend changes, remind the user to add screenshots or recordings to the PR after updating.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/update-existing-pr-msv9axi7/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/update-existing-pr-msv9axi7' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/update-existing-pr-msv9axi7/download' --output '.skill-downloads/update-existing-pr-msv9axi7/SKILL.md.part' && mv '.skill-downloads/update-existing-pr-msv9axi7/SKILL.md.part' '.skill-downloads/update-existing-pr-msv9axi7/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/update-existing-pr-msv9axi7/SKILL.md' && test -s '.skill-downloads/update-existing-pr-msv9axi7/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/update-pr' && cp -R '.skill-downloads/update-existing-pr-msv9axi7' '.claude/skills/update-pr'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/update-existing-pr-msv9axi7'

openskills read 'update-existing-pr-msv9axi7'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/update-existing-pr-msv9axi7/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills