cherry-pick-commit

Cherry-pick commits onto release branches and open backport pull requests.

1.2k|337|Updated Oct 13, 2022
One-click install
npx skills add https://github.com/dotnet/dotnet --skill cherry-pick-commit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cherry-pick-commit
Source: https://github.com/dotnet/dotnet/tree/main/src/nuget-client/.agents/skills/cherry-pick-commit
Command: npx skills add https://github.com/dotnet/dotnet --skill cherry-pick-commit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Backporting fixes from a development branch to a release or servicing branch is error-prone: branching off a stale local copy, silently mis-resolving conflicts, or forgetting to reference the original PR can introduce regressions. This Skill provides a safe, repeatable workflow for cherry-picking commits and opening a properly formatted backport pull request.

Core Features & Use Cases

  • Safe cherry-pick workflow: Fetches from origin, resolves the real source and target refs, branches off the remote target, and cherry-picks with -x to preserve provenance.
  • Conflict safety: Stops on conflicts, aborts cleanly, deletes the temporary branch, and reports the conflicting files instead of guessing a resolution.
  • PR creation via delegation: Hands off push and PR creation to the repository's create-pr skill with backport-specific title, base branch, and body linking the original PR.
  • Use Case: A user says "backport #7576 to release/8.0.x" — the Skill resolves the squash-merge commit, creates a dev-<handle>-cherrypick-7576-8.0.x branch off origin/release/8.0.x, cherry-picks it, and opens a ready PR referencing the original change.

Quick Start

Cherry-pick the latest commit from the dev branch onto the 7.9.x release branch and open a backport pull request.

Frequently Asked Questions about cherry-pick-commit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I backport a merged PR to a release branch with git?

Fetch from origin, create a new branch off the remote release branch, then run git cherry-pick -x with the PR's squash-merge commit SHA. Push the branch and open a pull request targeting the release branch that links back to the original PR.

How to cherry-pick the latest commit from one branch to another?

Run git fetch origin, resolve the source tip with git rev-parse origin/<branch>, create a working branch off the remote target ref, and run git cherry-pick -x <sha>. Never branch off a stale local copy of the target branch.

What should I do when a git cherry-pick hits conflicts?

Do not resolve conflicts silently. Run git cherry-pick --abort, delete the temporary branch, and report the conflicting files so a human can decide, since the target branch has diverged in the touched code.

Why does git cherry-pick say the previous cherry-pick is now empty?

An empty result means the change is already present in the target branch. Run git cherry-pick --skip or --abort and verify with git branch -r --contains <sha> whether the commit is already merged.

Can I cherry-pick a merge commit to another branch?

Merge commits require the -m 1 flag to select the mainline parent. It is preferable to cherry-pick the underlying squash-merge commit instead, which avoids the extra complexity.