Skip to content

docs: add cherry-picking guide to git workflow scenarios#115518

Open
lazizbekravshanov wants to merge 1 commit intofirstcontributions:mainfrom
lazizbekravshanov:docs/cherry-picking-guide
Open

docs: add cherry-picking guide to git workflow scenarios#115518
lazizbekravshanov wants to merge 1 commit intofirstcontributions:mainfrom
lazizbekravshanov:docs/cherry-picking-guide

Conversation

@lazizbekravshanov
Copy link
Copy Markdown

Summary

Adds a beginner-friendly guide for git cherry-pick, matching the style of the existing scenario guides (e.g. squashing-commits.md, resolving-merge-conflicts.md).

Cherry-picking is one of the operations new contributors most commonly encounter once they're past their very first PR — a maintainer asks them to pull a hotfix onto a release branch, or they've accidentally committed to the wrong branch and need to move one commit. The repo already has scenario guides for adjacent operations (squashing, reverting, merging, resolving conflicts) but nothing on cherry-pick.

Note on contribution workflow

.github/CONTRIBUTING.md says: "If you'd like to suggest a change in the tutorials or the workflow, please raise an issue. We can have a discussion to better understand the problem, get more people involved and make a collective decision."

I'm happy to close this PR and open an issue first if that's the maintainers' preferred flow for new content — just say the word. I wrote this directly as a PR because having something concrete to review usually makes the "is this worth having?" conversation faster, but I don't want to skip a process you have for good reasons.

What the guide covers

  • When cherry-pick is the right tool (hotfix onto release branch, moving a commit off the wrong branch) and when it isn't (a full merge would be simpler; the commit is already in your history).
  • Finding a commit's short hash with git log --oneline.
  • Cherry-picking a single commit and a range (a^..b inclusive-range syntax).
  • Resolving conflicts during a cherry-pick — --continue / --abort, with a cross-link to resolving-merge-conflicts.md.
  • A short note on the duplicate-history surprise that can happen if the source branch is later merged in too.

Index entry added to additional-material.md under Cherry-picking a commit.

Test plan

  • New file renders correctly in GitHub's markdown preview.
  • Internal link to resolving-merge-conflicts.md resolves.
  • Commands verified locally against a test repo.

🤖 Generated with Claude Code

Add a beginner-friendly guide explaining git cherry-pick:
- When cherry-picking is the right tool (hotfix onto a release branch,
  moving a commit off the wrong branch) and when it isn't (a full
  merge would be simpler; the commit is already in your history).
- Finding a commit's short hash with `git log --oneline`.
- Cherry-picking a single commit and a range.
- Resolving conflicts with --continue / --abort, cross-linking to
  resolving-merge-conflicts.md.
- A short note on duplicate-history surprises that can come from
  later merging the source branch in.

Index entry added to additional-material.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant