Member-only story
How to cherry-pick on GitHub
Imagine you have some changes in the dev branch. And you need one or few of the changes go to the main branch, and it can’t wait until the next release date. In this scenario, you can cherry-pick those changes into the main branch.
You can’t cherry pick from the UI on GitHub. (In Azure DevOps, you can cherry pick from the UI.) So you have to go to the command line and check out to the main branch (or any desired branch you want to cherry pick into). To cherry pick, you have to be on the target/desired branch.
git checkout main
Go to the dev branch on UI and find the commit id. Commit ids usually long alphanumerical ids. Copy the commit id, and go to the command line and type:
git cherry-pick 0016b85ffa950e6bb4845a3b038bfc39602c7300
Note that 0016b85ffa950e6bb4845a3b038bfc39602c7300 is my sample commit id. In your scenario, replace it with your commit id.
If there is any conflict, you will see the conflict message on the terminal. You will need to resolve them manually. There are three possibilities.
- You can accept the changes in dev.
- You can keep the changes in main.
- You can merge changes from both dev and main.