Receber por email
← Voltar para o catálogo

git-cherry-pick

Esta skill faz um cherry-pick do último commit de um branch de origem para um de destino. Opcionalmente, ela pode criar um pull request para o commit selecionado, utilizando o GitHub CLI, ao criar um novo branch a partir do destino, aplicar o commit e então gerar o PR.

556estrelas
Atualizado há 2 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add majiayu000/claude-skill-registry

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/git-cherry-pick/svg)](https://www.skillteca.com.br/skills/git-cherry-pick)

Skills relacionadas

Ver todas de Pesquisa e Web →

Alerta por categoria

Receba novas skills de Pesquisa e Web toda segunda

1 email curto, só com as skills novas de Pesquisa e Web. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

git-cherry-pick

Cherry-picks the last commit from a source branch onto a target branch. Supports an optional pull-request workflow that creates an intermediate branch and opens a PR via the GitHub CLI.

Installation

npx skills add adamdriscoll/skills
  • Git — <https://git-scm.com/downloads>
  • GitHub CLI (gh) — <https://cli.github.com>

Prerequisites

  • Git must be installed and available in PATH.
  • GitHub CLI (gh) must be installed and authenticated when using -CreatePullRequest (run gh auth login if needed).

Script

scripts/Invoke-GitCherryPick.ps1

Parameters

| Parameter | Type | Required | Description | |---|---|---|---| | SourceBranch | string | Yes | The branch whose last commit will be cherry-picked. | | TargetBranch | string | Yes | The branch to cherry-pick the commit onto. | | PullRequestBranch | switch | No | Creates a new branch from TargetBranch, cherry-picks there, and pushes to origin instead of committing directly. | | CreatePullRequest | switch | No | Opens a pull request from the new branch to TargetBranch using gh. Requires -PullRequestBranch. |

Usage Examples

Direct cherry-pick onto target branch

.\Invoke-GitCherryPick.ps1 -SourceBranch "feature/my-feature" -TargetBranch "main"

Checks out main, pulls the latest changes, and cherry-picks the last commit from feature/my-feature directly onto it.

Cherry-pick via a PR branch (no PR created)

.\Invoke-GitCherryPick.ps1 -SourceBranch "feature/my-feature" -TargetBranch "main" -PullRequestBranch

Creates a new branch named cherry-pick/feature/my-feature-to-main, cherry-picks the commit there, and pushes the branch to origin. No pull request is opened.

Cherry-pick and open a pull request

.\Invoke-GitCherryPick.ps1 -SourceBranch "feature/my-feature" -TargetBranch "main" -PullRequestBranch -CreatePullRequest

Full workflow: creates the PR branch, cherry-picks the commit, pushes to origin, and calls gh pr create to open a pull request from the new branch to main.

Behavior Notes

  • The PR branch is automatically named using the pattern cherry-pick/<SourceBranch>-to-<TargetBranch>, with any characters that are invalid in git branch names replaced by -.
  • If a cherry-pick conflict occurs, the script throws an error. Resolve the conflicts manually and run git cherry-pick --continue to finish.
  • The script uses git rev-parse on the source branch, so SourceBranch can be any valid git ref (branch name, tag, or commit SHA).
Compartilhar X LinkedIn