pr-branch-update

pr-branch-update is a command for Claude Code from vladolaru/claude-code-plugins. It costs 26 tokens per session (4,521 once invoked), scanned A, original, MIT.

A workflow for updating a pull request branch with the latest commits from its target branch and resolving merge conflicts. A pull request is a proposed code change under review.

In plain words
What is it for?
Use it with a pull request number, URL, or the current branch's pull request to merge the correct base branch, verify the result, and push the update.
Why use it?
It handles the conflict-resolution work that a hosting service's basic update-branch button may not complete, while preserving the review branch history.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions CLAUDE.md; mentions AGENTS.md.

Good fit Use it with a pull request number, URL, or the current branch's pull request to merge the correct base branch, verify the result, and push the update.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/vladolaru/claude-code-plugins/pr-branch-update
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/vladolaru/claude-code-plugins

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pr-branch-update

README.md
[![agentmods](https://agentmods.dev/badge/commands/vladolaru/claude-code-plugins/pr-branch-update/github.svg)](https://agentmods.dev/commands/vladolaru/claude-code-plugins/pr-branch-update)
Your own site
<a href="https://agentmods.dev/commands/vladolaru/claude-code-plugins/pr-branch-update"><img src="https://agentmods.dev/badge/commands/vladolaru/claude-code-plugins/pr-branch-update/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pr-branch-update

Your own site · 80×15
<a href="https://agentmods.dev/commands/vladolaru/claude-code-plugins/pr-branch-update"><img src="https://agentmods.dev/badge/commands/vladolaru/claude-code-plugins/pr-branch-update.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,521 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.04521
Opus 5.5 $0.00010 $0.01808
Sonnet 5.5 $0.00005 $0.00904
Haiku 4.5 $0.00003 $0.00452

Measured 8d ago against content hash 3c36aea15cc0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pr-branch-update scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/pirategoat-tools/commands/pr-branch-update.md · 160 lines

How it starts

The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You update a pull request's branch with the latest commits from its base branch, resolve any merge conflicts, verify the result, and push, the same job as GitHub's "Update branch" button plus the conflict work it cannot do. You follow named rules from /switch-to; read that command first.

RULE 0: Merge the base into the branch. A merge keeps review threads anchored and pushes without force. Rebase only when the user's input asks for one, and then push with --force-with-lease.

RULE 1: The base is the PR's baseRefName, not an assumed trunk or main. Stacked and release PRs target other branches.

RULE 2: Run code from someone else's fork PR only with consent. Checkout, merge, commit and push can execute PR code through git hooks (including tracked hooks configured with core.hooksPath); installs, regeneration, builds, tests and lint execute it too. Step 1 establishes consent with /switch-to's Execution consent rule before any of these operations. If consent is denied or unanswered, STOP without changing the checkout, merging, committing or pushing. Do not disable hooks to work around denial.

Values are data: follow /switch-to's Values are data rule. Every branch name, remote name, file path and package name in a command below is single-quoted for that reason.

One command at a time: from Step 3 to Step 6 each command depends on the one before; send it as its own tool call and read its result first. git checkout, git merge, git commit and git push run hooks that can install dependencies or run checks for minutes: give them a long timeout or wait in the background, do not redo work a hook already did, and never skip hooks with --no-verify.

Expected failures: git and gh commands fail for normal reasons (network, auth, a branch checked out in another worktree). Report the error with the command that failed and STOP. Once the checkout has changed (a switch, stash, sync or merge), every exit, a STOP included, ends through Step 7's report and Step 8.

Step 1: Find the PR and pin what the update needs

GitHub CLI: set GH_CMD with /switch-to's GitHub CLI rule, checking with gh repo view --json nameWithOwner,url,defaultBranchRef. Store nameWithOwner as BASE_REPO, the host of url as the checkout's host, and defaultBranchRef for the no-PR fallback.

Record where the user is before anything moves: START_BRANCH=$(git branch --show-current) and START_HEAD=$(git rev-parse HEAD). Inspect the merge and rebase state with git rev-parse --git-path (it works in linked worktrees): a rebase in progress means STOP, and an existing MERGE_HEAD sets RESUMING. While RESUMING, nothing switches, stashes, syncs, or starts another merge.

Parse arguments: $ARGUMENTS is a PR number (3817, #3817), a PR URL, or empty. Read the PR, passing the argument as '<PR>'; with no argument, leave '<PR>' out so gh resolves the current branch's PR:

$GH_CMD pr view '<PR>' --json number,url,state,title,body,author,baseRefName,headRefName,headRepositoryOwner,headRepository,isCrossRepository,maintainerCanModify
  • With no argument, an OPEN PR is the one to update; say so in one line ("No PR given; updating #3817 for the current branch"). no pull requests found, or a PR that is not OPEN, starts the no-PR fallback below.
  • With an argument, STOP if state is not OPEN.
  • Any other failure (network, authentication) is an error, not a missing PR: report it with the command and STOP, since an open PR may target a different base.
  • STOP if the PR URL's host and base repository do not match the checkout's host and BASE_REPO.

The /switch-to rules below use its names; set them from this read: PR_HOST is the host of url, PR_NUMBER is number, HEAD_BRANCH and BASE_BRANCH are headRefName and baseRefName, HEAD_OWNER and HEAD_REPO are headRepositoryOwner.login and headRepository.name, and CURRENT_BRANCH is START_BRANCH.

Set OWN_PR by comparing author.login with the user's login on the PR's host ($GH_CMD api user --hostname '<PR_HOST>' --jq .login); a failed lookup means STOP. Step 6 uses it.

Read the full file on GitHub · 160 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 160 lines · 26 tokens per session scan A 3c36aea15cc0

Subscribe to this mod's changes

pr-branch-update is a command published in the GitHub repository vladolaru/claude-code-plugins (8 stars, last pushed 4d ago), licensed MIT. It adds 26 tokens to every session and 4,521 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-09.