Claude Skills Guide

Claude Code Git Cherry-Pick Workflow Guide

Git cherry-pick stands as one of the most powerful yet underutilized commands in a developer’s toolkit. When you need to bring specific commits from one branch into another without merging entire branches, cherry-pick delivers precision control. Combined with Claude Code CLI, you can streamline these workflows, handle conflicts more efficiently, and automate repetitive backporting tasks.

This guide covers practical cherry-pick workflows that developers and power users can implement immediately.

Understanding Cherry-Pick Basics

Cherry-pick allows you to apply specific commits from one branch onto another. Unlike a full merge or rebase, cherry-pick grabs only the changes from selected commits while leaving your branch history intact.

The basic syntax works like this:

git cherry-pick <commit-hash>

For multiple commits:

git cherry-pick commit1 commit2 commit3

Or pick a range:

git cherry-pick commit1..commit3

Claude Code can help identify which commits to pick by analyzing your git log. Simply ask Claude to review recent commits on a feature branch and suggest which ones should be backported to a release branch.

Practical Workflows for Developers

Backporting Bug Fixes

One of the most common use cases involves applying critical bug fixes from main to release branches. Suppose you’re maintaining a stable release branch while developing features on main. When a bug fix lands on main, you need that same fix on your release branch.

# First, find the commit
git log --oneline main --grep="fix"

# Cherry-pick the fix onto release branch
git checkout release-2.1
git cherry-pick abc1234

Using the supermemory skill with Claude Code helps track which commits have already been backported, preventing duplicate work. Document each cherry-picked commit with its purpose and original branch for future reference.

Applying Hotfixes Across Branches

Production issues demand rapid response. When pushing a hotfix to production, you often need that same fix on development, staging, and release branches simultaneously.

# Apply hotfix to all relevant branches
git checkout production
git cherry-pick def5678

git checkout staging  
git cherry-pick def5678

git checkout develop
git cherry-pick def5678

Claude Code can execute these commands in sequence, handling any conflicts as they arise. Ask Claude to run the cherry-pick and report any issues requiring manual intervention.

Selective Feature Backporting

Sometimes you want only certain features from a branch, not the entire change set. This frequently occurs when feature branches contain multiple independent improvements.

# View commits in the feature branch
git log feature/new-dashboard --oneline

# Pick specific commits selectively
git cherry-pick ghi9012 jkl3456

The tdd skill complements this workflow by helping you verify that cherry-picked commits include their corresponding tests, maintaining code quality during selective backporting.

Handling Merge Conflicts

Cherry-pick inevitably produces conflicts when the same lines were modified differently in the source and target branches. Claude Code simplifies conflict resolution.

When conflicts occur, Git pauses and reports:

error: could not apply abc1234... Fix authentication bug
hint: after resolving the conflicts, mark the corrected paths
hint: with "git add <paths>" and run "git cherry-pick --continue"

Claude can help by:

Manual resolution follows a clear pattern:

# See conflicting files
git status

# Edit files to resolve conflicts
# Then stage resolved files
git add conflicted-file.js

# Continue the cherry-pick
git cherry-pick --continue

For complex conflicts, abort and reconsider:

git cherry-pick --abort

Automating with Claude Code Skills

Creating a Claude skill for cherry-pick workflows standardizes your team’s approach. A custom skill can:

  1. List commits eligible for cherry-pick from a specific branch
  2. Validate that commits include tests before picking
  3. Generate pull requests automatically after cherry-picking
  4. Track cherry-picked commits to prevent duplicates

Here’s a sample skill workflow:

User: Cherry-pick the auth fix from main to release branch
Claude: Let me find the relevant commit first...

[Claude analyzes git log, identifies commit]
[Applies cherry-pick to release branch]
[Reports success or identifies conflicts]

The frontend-design skill can help if cherry-picks involve UI component changes, ensuring design consistency across branches.

Best Practices

Always Test Before Cherry-Picking to Production

Run your test suite after any cherry-pick:

npm test  # or your equivalent test command
git push origin production

Document Cherry-Picked Commits

Include references in commit messages:

Cherry-picked from main: abc1234 - Fix login timeout issue
Backported for release 2.1.3

Use Tags for Tracking

Tag cherry-picked commits for visibility:

git tag cherrypick/release-2.1/fix-login abc1234

Summary

Git cherry-pick combined with Claude Code CLI transforms how you handle targeted code changes across branches. Whether backporting hotfixes, applying specific features, or managing complex release workflows, this combination provides precision and automation that scales.

The key is establishing consistent patterns: always verify commits before picking, handle conflicts methodically, and document your changes thoroughly. Claude Code handles the execution and analysis, letting you focus on decision-making rather than manual command execution.

Start with simple cherry-picks, gradually incorporating them into your regular workflow. Soon, you’ll wonder how you managed without this capability.

Built by theluckystrike — More at zovo.one