Mise à jour de pull request GitHub

VérifiéSûr

Met à jour un pull request GitHub existant après l'ajout de commits, en révisant le titre et le corps selon un modèle de template s'il existe. Utile après avoir poussé de nouvelles modifications sur une branche déjà associée à une PR ouverte.

Spar Skills Guide Bot
DeveloppementIntermédiaire
18002/06/2026
Claude CodeCursorWindsurf
#github-pull-requests#git-workflow#pr-update#collaboration

Recommandé pour

Notre avis

Met à jour une pull request GitHub existante après de nouveaux commits en révisant le titre et le corps, en respectant le modèle de PR et en poussant les modifications.

Points forts

  • Automatise la mise à jour du titre et du corps de PR avec détection de langue et respect des templates.
  • Gère les commits non poussés et les modifications non commitées de manière interactive.
  • Intègre les références à des issues, documents ou PRs depuis la conversation.

Limites

  • Nécessite que l'outil gh et git soient configurés sur le poste de travail.
  • Ne fonctionne que pour les branches locales avec une PR ouverte sur GitHub.
  • La détection de langue peut être ambiguë si le modèle ou les messages utilisateur sont mixtes.
Quand l'utiliser

Utilisez cette compétence lorsque vous avez ajouté des commits à une branche et souhaitez mettre à jour la pull request correspondante de manière propre.

Quand l'éviter

Ne l'utilisez pas pour créer une nouvelle PR, pour des PRs fermées ou si vous souhaitez modifier manuellement le titre sans passer par le flux complet.

Analyse de sécurité

Sûr
Score qualité95/100

The skill uses git and gh commands only for PR management, no destructive or exfiltrating actions, all within safe boundaries.

Aucun point d'attention détecté

Exemples

Update current PR after new commits
Update the pull request for this branch with the latest changes.
Update PR with template and language override
I've pushed more fixes. Please update this PR and use French for the title.
Update PR and add reference links
Update the PR body to include the issue #123 and the related PR #456 in the References section.

name: update-pr description: Update an existing GitHub pull request after adding commits by revising title/body, preserving template format, and pushing pending branch changes. allowed-tools: Bash(git status *), Bash(git diff *), Bash(git log *), Bash(git rev-parse *), Bash(git push *), Bash(git ls-files *), Bash(gh repo view *), Bash(gh pr view *), Bash(gh pr edit *), Read, Glob, Grep, AskUserQuestion

Pre-fetched context

!git rev-parse --abbrev-ref HEAD !git status --short !git ls-files ':(top,icase).github/pull_request_template.md' ':(top,icase).github/pull_request_template/*.md' ':(top,icase)pull_request_template.md'

Instructions

Update the existing pull request for the current branch. Follow this flow:

  1. Gather context: Get default branch via gh repo view --json defaultBranchRef -q .defaultBranchRef.name, then run git log --oneline, git diff --stat, and git diff against it.

  2. Missing PR check: Run gh pr view --json number,url,title,body,baseRefName,headRefName,isDraft. If it fails, tell the user there is no open PR for this branch. Ask whether to switch to /create-pr or abort.

  3. Uncommitted changes: If git status above shows output, ask whether to commit them, ignore them, or abort. Do not proceed until answered.

  4. PR template:

    • If a template path is listed, Read it before writing title/body.
    • Detect template_language from headings/instructions/checklists (ignore code, URLs, HTML comments).
    • Keep template headings/order and keep HTML comments (<!-- -->).
    • If no template exists, skip.
  5. Compose updated PR content:

    • Infer what changed since the previous PR revision from the commit log and diff.
    • Title: Conventional Commits, under 72 chars.
    • Decide title language before drafting and keep it fixed unless the user requests a change.
    • Title language policy: use template_language first whenever it can be detected.
    • If the user explicitly asks to override language for the current PR, follow that override.
    • If no template_language is detected, use: explicit user request > latest substantive user message > English.
    • Ignore slash commands (for example /update-pr), code blocks, file paths, and URLs when inferring language.
    • If language signals conflict or are ambiguous, ask the user which language to use before drafting.
    • Keep type(scope) tokens standard (feat, fix, etc.); localize only the description text.
    • Body: if template exists, fill its sections. If not, use Summary / Changes / Concerns / References.
    • Proactively include any reference links (issues, docs, related PRs) found in conversation history.
  6. Confirm: Show the full updated PR title/body. Ask if the user wants to change the title, add links, or make any edits — apply and re-confirm. Do not push or edit until approved.

  7. Push and update:

    • Push (git push -u origin HEAD) only if there are unpushed commits (git log @{upstream}..HEAD).
    • Update with gh pr edit --title "<title>" --body-file <file>.
    • Return the PR URL.
Skills similaires