Por Anónimo (no verificado) , 29 Abril 2026

Lo que lograrás

Harás cherry-pick de un solo commit, un rango y un merge de un branch a otro, manejando conflictos cuando surjan.

Configurar un sandbox

mkdir cherry-tutorial && cd cherry-tutorial
git init
echo "v1" > app.txt
git add . && git commit -m "Initial"

git checkout -b release/1.0
echo "release" > release.txt
git add . && git commit -m "Release notes"

git checkout main
git checkout -b feature
echo "fix" > fix.txt
git add . && git commit -m "Critical bug fix"
echo "feat" > feat.txt
git add . && git commit -m "New feature work"

Paso 1: identificar el commit

git log feature --oneline

Paso 2: cherry-pick

git checkout release/1.0
git cherry-pick def5678

Paso 3: registrar el linaje

git cherry-pick -x def5678

Paso 4: cherry-pick de un rango

git cherry-pick def5678..abc1234
git cherry-pick def5678^..abc1234

Paso 5: manejar conflictos

git cherry-pick <sha>
git add <file>
git cherry-pick --continue
git cherry-pick --abort

Paso 6: cherry-picks vacíos

git cherry-pick --allow-empty <sha>
git cherry-pick --skip

Paso 7: cherry-pick de un merge

git cherry-pick -m 1 <merge-sha>

Paso 8: verificar

git log --oneline
git diff main release/1.0

Workflows comunes

Back-port de hotfix

git checkout release/1.4
git cherry-pick -x <hotfix-sha>
git push

Rescate de un branch que descartarás

git checkout main
git cherry-pick <valuable-sha>
git branch -D experimental

Reenviar fixes entre líneas de mantenimiento

for branch in release/1.4 release/1.5 main; do
  git checkout $branch
  git cherry-pick -x <fix-sha>
done

Trampas

  • Commits duplicados.
  • Contexto perdido.
  • Cherry-picking repetido.