rally-merge-pr

rally-merge-pr is a command for Claude Code from ddgonzal3/rally. It costs 0 tokens per session (582 once invoked), scanned A, original, MIT.

A GitHub and Git command sequence for merging the pull request belonging to the current feature branch and then updating that branch from the main branch. A pull request is a proposed set of changes awaiting review and merge.

In plain words
What is it for?
Use it after a feature branch has an open pull request: detect the branch and pull request, verify it is mergeable, squash-merge it, update main, and sync the feature branch while staying on it.
Why use it?
It checks that you are on the intended branch, that a pull request exists, and that it has no merge conflicts before changing repository history. It keeps the remote feature branch and local branch after the merge.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it after a feature branch has an open pull request: detect the branch and pull request, verify it is mergeable, squash-merge it, update main, and sync the feature branch while staying on it.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/ddgonzal3/rally/rally-merge-pr
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/ddgonzal3/rally

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 rally-merge-pr

README.md
[![agentmods](https://agentmods.dev/badge/commands/ddgonzal3/rally/rally-merge-pr/github.svg)](https://agentmods.dev/commands/ddgonzal3/rally/rally-merge-pr)
Your own site
<a href="https://agentmods.dev/commands/ddgonzal3/rally/rally-merge-pr"><img src="https://agentmods.dev/badge/commands/ddgonzal3/rally/rally-merge-pr/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 rally-merge-pr

Your own site · 80×15
<a href="https://agentmods.dev/commands/ddgonzal3/rally/rally-merge-pr"><img src="https://agentmods.dev/badge/commands/ddgonzal3/rally/rally-merge-pr.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 582 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.00000 $0.00582
Opus 5 $0.00000 $0.00291
Sonnet 5 $0.00000 $0.00116
Haiku 4.5 $0.00000 $0.00058

Measured 11d ago against content hash 3207017397e5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

rally-merge-pr 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 11d 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.

src-tauri/resources/commands/rally-merge-pr.md · 76 lines

How it starts

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

Merge PR: Merge, Sync, Stay on Feature Branch

You are merging the current branch's PR and syncing the feature branch with main. Follow each step exactly.

Step 1: Detect State

BRANCH=$(git symbolic-ref --short HEAD)
MAIN_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
[ -z "$MAIN_BRANCH" ] && MAIN_BRANCH="main"
PR_NUM=$(gh pr view --json number -q '.number' 2>/dev/null)
echo "BRANCH=$BRANCH MAIN=$MAIN_BRANCH PR=$PR_NUM"

Guard rails:

  • If BRANCH equals MAIN_BRANCH, STOP: "You're on the main branch. Switch to the feature branch whose PR you want to merge."
  • If PR_NUM is empty, STOP: "No PR found for this branch. Create a PR first."

Step 2: Verify PR is Mergeable

MERGEABLE=$(gh pr view "$PR_NUM" --json mergeable -q '.mergeable')
echo "MERGEABLE=$MERGEABLE"

If MERGEABLE=CONFLICTING, STOP: "PR has merge conflicts. Resolve them before merging."

Step 3: Merge the PR

Merge with squash. Do NOT delete the remote branch.

gh pr merge "$PR_NUM" --squash

Step 4: Sync Feature Branch

After the merge is complete, sync the local environment:

# 1. Update main with the merged changes
git checkout "$MAIN_BRANCH"
git pull

# 2. Go back to the feature branch
git checkout "$BRANCH"

# 3. Count commits ahead of main (these were squash-merged, now redundant)
AHEAD=$(git rev-list --count "$MAIN_BRANCH".."$BRANCH")
echo "Commits to reset: $AHEAD"

# 4. Reset the redundant commits and rebase onto main
if [ "$AHEAD" -gt 0 ]; then
  git reset --hard "HEAD~$AHEAD"
fi
git rebase "$MAIN_BRANCH"

# 5. Push the synced branch to keep remote in sync
git push --force-with-lease

Step 5: Final Output

Print a summary:

  • PR number and URL that was merged
  • Branch that was synced
  • Current state: on BRANCH, synced with MAIN_BRANCH

Example:

Merged PR #42 (squash) into main.
Synced feature-branch with main (reset 3 commits, rebased).
Currently on: feature-branch (synced with main)

Read the full file on GitHub · 76 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. 11d ago First seen · 76 lines · 0 tokens per session scan A 3207017397e5

Subscribe to this mod's changes

rally-merge-pr is a command published in the GitHub repository ddgonzal3/rally (6 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 582 tokens. 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-08-31.