Cherry-Pick Made Simple

Cherry-Pick Made Simple

Introduction

In collaborative development, multiple teams often work on different features while production systems may require urgent fixes. Managing these changes across development, testing, and production environments can be tricky — especially when using a branching strategy in Azure DevOps.

In this blog, we’ll walk through a real-world scenario involving three branches — main (development)release (testing), and trunk (production) — and show why cherry-picking is sometimes the best approach over a full merge

Scenario

Considering we maintain separate branches for each environment:

  • main → development
  • release → testing
  • trunk → production

new requirement (Notebook 3) was developed in a feature branch and merged into main.

Cherry-Pick Made Simple

At the same time, a critical production issue was found in Notebook 2. To fix this:

  • A new branch was created from the main
image 14 - cherry-pick
  • The fix was applied and merged back into main
image 15 - cherry-pick

Now, the bug fix needs to be pushed to production.

Option 1: Full Merge

Merging the main → release would bring in:
✅ The bug fix for Notebook 2
❌ The new requirement(Notebook 3) which is not yet tested

This risks introducing untested code into testing and production environments.

image 16 - cherry-pick

Option 2: Cherry Pick (Preferred)

Instead of merging everything from main, we selectively pick only the bug fix commit for Notebook 2 and apply it to the release, and then forward it to trunk.

What is Cherry Pick?

Cherry-picking means picking only the specific change you want from one branch and applying it to another — without bringing all other changes along.

In our case, cherry-picking ensures:

  • Only the bug fix for Notebook 2 is moved forward
  • The new requirement(Notebook 3) stays in main until it’s tested and ready
Press enter or click to view image in full size
image 17 - cherry-pick

Conclusion

Cherry-picking is a powerful tool when you need precision. It allows you to keep environments in sync with only the necessary changes, without risking the stability of your testing or production systems.

-Sanghavi.A.R
Data Engineer