agentleFS
PradnyeshpPradnyeshp/Claude-Skills/.claude/skills/cherry-pick/SKILL.md

cherry-pick

Skill2 starsChanged 4 months agoMITView on GitHub

Apply specific commits from one branch onto another with git cherry-pick — backport a fix, pull a single feature commit across branches, or recover a commit — safely and with conflict handling. Use when the user says "cherry-pick this commit", "backport this fix to the release branch", "apply commit X to main", "bring that commit over here", "port this change to another branch", or "I need just one commit from that branch".

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Require a clean working tree: If there are uncommitted changes, stop and tell the user to commit or stash first (see the stash skill) — …

    line 23
  2. Distinctive:

    Check it isn't already there: Look for the change on the target (git log --oneline --grep or compare patches) — cherry-picking something …

    line 25
  3. Very specific:

    Use -n/--no-commit to stage without committing when the user wants to review or combine before committing.

    line 29
  4. Distinctive:

    Verify and report: After applying, confirm the result builds/tests pass where relevant, show the new git log --oneline, and note that …

    line 31
  5. Distinctive:

    Never start with a dirty tree or without confirming both the source commit(s) and the destination branch.

    line 35
  6. Distinctive:

    Check whether the change is already present before applying — avoid duplicate or empty commits.

    line 36
  7. Very specific:

    Use -x for backports so the origin commit is recorded, and prefer cherry-picking the minimal set — for many commits across branches, …

    line 38

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Branch & commit context

!git status --short 2>/dev/null

!git branch --show-current 2>/dev/null

!git log --oneline -10 2>/dev/null

Instructions

Apply the commit(s) in $ARGUMENTS onto the current branch with git cherry-pick. Cherry-picking copies commits and can conflict or duplicate work — confirm the target commits and the destination branch before starting, and stop to let the user resolve conflicts rather than guessing.

Method

  1. Require a clean working tree. If there are uncommitted changes, stop and tell the user to commit or stash first (see the stash skill) — cherry-pick refuses to run mid-mess and a dirty tree risks losing work.
  2. Confirm what and where. Verify you're on the intended destination branch and identify the exact commit(s): a single SHA, a list, or a range (A..B excludes A; A^..B includes it). Show git show --stat <sha> for each so the user confirms these are the right changes before applying.
  3. Check it isn't already there. Look for the change on the target (git log --oneline --grep or compare patches) — cherry-picking something already merged creates a duplicate/empty commit. If the same content is present, say so instead of re-applying.
  4. Apply deliberately:
    • Single or several commits: git cherry-pick <sha> [<sha>...] (applies oldest-first).
    • Preserve provenance for backports with -x, which appends a "cherry picked from commit <sha>" line so the origin is traceable.
    • Use -n/--no-commit to stage without committing when the user wants to review or combine before committing.
  5. Handle conflicts as a checkpoint. On conflict, do not force a resolution — show the conflicted files, explain both sides, and resolve like a merge (see resolve-conflicts). Continue with git cherry-pick --continue, or back out cleanly with git cherry-pick --abort (or --skip for an already-applied commit). Never leave the repo mid-cherry-pick silently.
  6. Verify and report. After applying, confirm the result builds/tests pass where relevant, show the new git log --oneline, and note that cherry-picked commits have new SHAs — so the branches will show the change twice if they're later merged.

Rules

  1. Never start with a dirty tree or without confirming both the source commit(s) and the destination branch.
  2. Check whether the change is already present before applying — avoid duplicate or empty commits; surface it if it's already there.
  3. On conflict, stop and let the user resolve; never guess a resolution. Always offer --continue / --abort and never abandon the repo in a half-applied state.
  4. Use -x for backports so the origin commit is recorded, and prefer cherry-picking the minimal set — for many commits across branches, consider whether a merge or rebase is the right tool instead.
  5. End with the resulting history, confirmation tests pass, and a note that the commits are copies with new SHAs.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.