cherry-pick-by-patch

cherry-pick-by-patch is a command for Claude Code from openshift-eng/ai-helpers. It costs 13 tokens per session (353 once invoked), scanned A, original, Apache-2.0.

A Git command that applies a commit by turning its changes into a patch, then creates a new commit with the original message. A patch is a text description of file additions, changes, and removals.

In plain words
What is it for?
Use it to apply a commit by hash, stage the resulting file changes, remove deleted files, and preserve the original commit text.
Why use it?
It provides an alternative way to copy a commit into the current branch when the normal cherry-pick command is not being used.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: positional $N argument.

Part of the git plugin — 2 skills, 10 commands shipped together

Good fit Use it to apply a commit by hash, stage the resulting file changes, remove deleted files, and preserve the original commit text.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/openshift-eng/ai-helpers/cherry-pick-by-patch
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/openshift-eng/ai-helpers

Made for: Claude Code.

Or install git, the plugin that ships this one along with the rest of its 2 skills, 10 commands.

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 cherry-pick-by-patch

README.md
[![agentmods](https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/cherry-pick-by-patch/github.svg)](https://agentmods.dev/commands/openshift-eng/ai-helpers/cherry-pick-by-patch)
Your own site
<a href="https://agentmods.dev/commands/openshift-eng/ai-helpers/cherry-pick-by-patch"><img src="https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/cherry-pick-by-patch/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 cherry-pick-by-patch

Your own site · 80×15
<a href="https://agentmods.dev/commands/openshift-eng/ai-helpers/cherry-pick-by-patch"><img src="https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/cherry-pick-by-patch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 353 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.00013 $0.00353
Opus 5.5 $0.00005 $0.00141
Sonnet 5.5 $0.00003 $0.00071
Haiku 4.5 $0.00001 $0.00035

Measured 1mo ago against content hash b9f8cc4a254f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cherry-pick-by-patch 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 1mo 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

plugins/git/commands/cherry-pick-by-patch.md · 51 lines

What it actually says

Name

git:cherry-pick-by-patch

Synopsis

/git:cherry-pick-by-patch commit_hash

Description

The /git-cherry-pick-by-patch commit_hash command cherry-picks commit with hash commit_hash into current branch. Rather then doing git cherry-pick commit_hash, the command streams the output of git show commit_hash to patch -p1 --no-backup-if-mismatch, and then commit changes with commit message from commit_hash commit.

Implementation

Pre-requisites

The commit with hash commit_hash must exist. To verify that use:

git show commit_hash

and check if exit code is zero.

Fail, if there is no commit_hash in the current repository checkout.

Cherry-pick commit_hash into current branch

  1. Execute command
    git show commit_hash | patch -p1 --no-backup-if-mismatch
    

and check if exit code is zero. Fail if exit code is not zero.

  1. Find files removed from local checkout by the patch command and execute git rm for them.

  2. Find files added or modified by the patch command and execute git add for them.

  3. Commit changes by git commit command and use commit title and description from commit_hash commit.

Arguments

  • $1 (required): Commit hash (e.g., 902409c0) of commit to cherry-pick.
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. 1mo ago First seen · 51 lines · 13 tokens per session scan A b9f8cc4a254f

Subscribe to this mod's changes

cherry-pick-by-patch is a command published in the GitHub repository openshift-eng/ai-helpers (121 stars, last pushed today), licensed Apache-2.0. It adds 13 tokens to every session and 353 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-09-03.