cherry-pick
Skill839 starsChanged 51 days agoApache-2.0View on GitHub
Cherry-pick a commit from origin/main into a release branch using a temporary git worktree
- Commits and pushes
We split this skill into the rules it gives an agent
24 rules. 0 are common, 11 are distinctive, and 13 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Before starting, check if there is an existing cherry-pick worktree from a previous run:
- Very specific: line 18
If there is a worktree on a cherry-pick/* branch, a previous cherry-pick may have stopped due to conflicts.
- Distinctive: line 20
Check the cherry-pick state:
- Very specific: line 24
If the cherry-pick is still in progress (conflicts resolved, staged), run git -C "$WORKTREE_DIR" cherry-pick --continue to finalize.
- Distinctive: line 25
If the working tree is clean (cherry-pick already completed), proceed to push.
- Very specific: line 32
Do NOT use the worktree's HEAD SHA — that's the new cherry-pick commit, not the original.
- Distinctive: line 35
If the user does not want to resume, clean up the stale worktree first, then start fresh.
- Very specific: line 45
Run git log origin/main --oneline -20 to get the list.
- Very specific: line 48
Use AskUserQuestion to present the recent commits as options.
- Very specific: line 59
Run git branch -r --list 'origin/release/*' to get all remote release branches matching release/X.X.X.
- Very specific: line 62
Use AskUserQuestion to present the release branches as options.
- Distinctive: line 82
If there are conflicts:
- Distinctive: line 83
Do NOT force resolve conflicts automatically.
- Distinctive: line 84
Do NOT clean up the worktree — leave it in place so the user can fix conflicts.
- Very specific: line 88
If conflict resolution requires a separate commit (not cherry-pick --continue), use git commit -s with a HEREDOC message.
- Very specific: line 97
If gh is available and authenticated, create the PR automatically:
- Very specific: line 115
If gh is not set up or the command fails, skip this step and tell the user to create the PR manually at: …
- Distinctive: line 131
If step 11 was skipped (no PR created), omit the PR Release line and instead print the manual comparison URL from step 11's fallback.
- Very specific: line 135
NEVER add a Co-Authored-By line
- Very specific: line 136
NEVER manually add a Signed-off-by line — git commit -s handles this automatically
- Distinctive: line 137
If the cherry-pick results in a new commit (e.g.
- Very specific: line 140
NEVER use git stash, git reset, git revert, git checkout -- <file>, git restore, or git clean
- Distinctive: line 141
Always clean up the worktree after a successful push or if the user abandons the cherry-pick
- Distinctive: line 143
If anything else fails, clean up the worktree and report the error to the user
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cherry-Pick to Release Branch
Cherry-pick a commit from origin/main into a release branch using a temporary git worktree.
Resume Check
Before starting, check if there is an existing cherry-pick worktree from a previous run:
git worktree list | grep cherry-pick/If there is a worktree on a cherry-pick/* branch, a previous cherry-pick may have stopped due to conflicts. Ask the user if they want to resume it. If yes:
- Set
WORKTREE_DIRto the existing worktree path. - Check the cherry-pick state:
git -C "$WORKTREE_DIR" status- If the cherry-pick is still in progress (conflicts resolved, staged), run
git -C "$WORKTREE_DIR" cherry-pick --continueto finalize. - If the working tree is clean (cherry-pick already completed), proceed to push.
- If the cherry-pick is still in progress (conflicts resolved, staged), run
- Recover the original source commit SHA from the worktree's branch name (it's encoded as
cherry-pick/<source-sha>-to-<release-branch>):
Do NOT use the worktree's HEAD SHA — that's the new cherry-pick commit, not the original. Then run step 4 withBRANCH=$(git -C "$WORKTREE_DIR" branch --show-current) SOURCE_SHA=${BRANCH#cherry-pick/} SOURCE_SHA=${SOURCE_SHA%-to-*}$SOURCE_SHAto gather the original PR metadata. - Continue from step 10 (push) onward.
If the user does not want to resume, clean up the stale worktree first, then start fresh.
Steps
- Fetch latest from origin:
git fetch origin - Show recent commits on origin/main:
Run
git log origin/main --oneline -20to get the list. - Ask the user which commit to cherry-pick:
Use
AskUserQuestionto present the recent commits as options. Let the user select one. - Look up the original PR for the selected commit:
gh pr viewdoes not accept a commit SHA, so query the commits→pulls API directly:
Save the PR number and title for use in steps 11 and 13. If the commit message contains a PR number (e.g.gh api repos/ai-dynamo/aiperf/commits/<source-commit-sha>/pulls \ --jq '.[0] | "\(.number)\t\(.title)"'(#669)), you can also use that directly. - Find all release branches:
Run
git branch -r --list 'origin/release/*'to get all remote release branches matchingrelease/X.X.X. - Ask the user which release branch to target:
Use
AskUserQuestionto present the release branches as options. The most recent version (highest semver) should be the first option marked as "(Recommended)". - Create a temporary worktree on a feature branch:
Release branches are protected, so work on a
cherry-pick/feature branch from the start. This also makes the worktree identifiable for resume if conflicts occur.WORKTREE_DIR=$(mktemp -d) git worktree add "$WORKTREE_DIR" origin/<release-branch> git -C "$WORKTREE_DIR" checkout -b cherry-pick/<commit-hash>-to-<release-branch> - Set up the environment in the worktree (required for pre-commit hooks):
make -C "$WORKTREE_DIR" first-time-setup - Cherry-pick the commit:
If there are conflicts:git -C "$WORKTREE_DIR" cherry-pick <commit-hash>- Do NOT force resolve conflicts automatically.
- Do NOT clean up the worktree — leave it in place so the user can fix conflicts.
- Tell the user:
- The worktree path:
$WORKTREE_DIR - To resolve conflicts in that directory, stage the fixes, then run:
git -C "$WORKTREE_DIR" cherry-pick --continue - If conflict resolution requires a separate commit (not
cherry-pick --continue), usegit commit -swith a HEREDOC message. - Once resolved, re-run
/cherry-pickto resume (it will detect the existing worktree).
- The worktree path:
- Push the feature branch:
git -C "$WORKTREE_DIR" push -u origin HEAD - Create PR (optional — requires
ghCLI): Ifghis available and authenticated, create the PR automatically:
Ifgh pr create \ --repo ai-dynamo/aiperf \ --head cherry-pick/<commit-hash>-to-<release-branch> \ --base <release-branch> \ --label cherry-pick \ --title "<original commit title> (cherry-pick to <release-branch>)" \ --body "$(cat <<'EOF' ## Summary - Cherry-pick of <commit-hash> from `main` into `<release-branch>` - Original PR: #<original-pr-number> — <original commit title> ## Conflicts <If conflicts were resolved, list the files and briefly describe the resolution. Otherwise write "None — clean cherry-pick."> EOF )"ghis not set up or the command fails, skip this step and tell the user to create the PR manually at:https://github.com/ai-dynamo/aiperf/compare/<release-branch>...cherry-pick/<commit-hash>-to-<release-branch> - Clean up the worktree:
git worktree remove "$WORKTREE_DIR" Print a summary. Output the following (NOT inside a code block):
Cherry-pick complete:
<commit-hash-short>→<release-branch><original commit title>PR Main:
<original-pr-number>:git-merged: https://github.com/ai-dynamo/aiperf/pull/<original-pr-number>PR Release:<cherry-pick-pr-number>:pr-opened: https://github.com/ai-dynamo/aiperf/pull/<cherry-pick-pr-number>If step 11 was skipped (no PR created), omit the PR Release line and instead print the manual comparison URL from step 11's fallback.
Rules
- NEVER add a
Co-Authored-Byline - NEVER manually add a
Signed-off-byline —git commit -shandles this automatically - If the cherry-pick results in a new commit (e.g. conflict resolution), use
git commit -swith a HEREDOC message - NEVER use
--no-verify - NEVER force push
- NEVER use
git stash,git reset,git revert,git checkout -- <file>,git restore, orgit clean - Always clean up the worktree after a successful push or if the user abandons the cherry-pick
- On cherry-pick conflicts: do NOT clean up the worktree — leave it for the user to resolve, then resume
- If anything else fails, clean up the worktree and report the error to the user
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- MystenLabs/sui★ 7.8ksame name
- fleetdm/fleet★ 7.1ksame name
- microsoft/DirectXShaderCompiler★ 3.7ksame name
- vaadin/web-components★ 584same name
- yuzono/anime-extensions★ 527same name
- Pradnyeshp/Claude-Skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/python.mdcCursor rule
- aiperf-code-reviewSkill
- aiperf-kube-runSkill
- aiperf-kube-setupSkill
- aiperf-kube-sweepSkill
- aiperf-kube-triageSkill
- aiperf-llm-ergonomics-reviewSkill
- bump-versionSkill
- docs-to-fernSkill
- linear-issueSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

