Skip to content

Instantly share code, notes, and snippets.

@nicholashoule
Last active March 12, 2026 06:39
Show Gist options
  • Select an option

  • Save nicholashoule/71293b879bc88e1365579c89f95e6b1c to your computer and use it in GitHub Desktop.

Select an option

Save nicholashoule/71293b879bc88e1365579c89f95e6b1c to your computer and use it in GitHub Desktop.
Cherry pick a merge and create a pull request for the master branch

Git - cherry-pick

macOS

brew install git

Windows

winget install --id Git.Git -e --source winget

Git cherry pick and push to patch branch

Summary of the workflow

This sequence of commands creates a clean, up-to-date patch branch from main, then cherry-picks a single, specific commit to it. This is a common workflow for applying a hotfix from a feature branch to the main development branch or for isolating a single commit to apply elsewhere.

git show --summary
git show --summary <sha>
git checkout main && git pull
git checkout -b patch/mypatch
git cherry-pick [commit-hash]
git push -u origin patch/mypatch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment