Azure DevOps Cherry Pick: Frequently, creating software or applications involves writing millions of lines of code. To make improvements or add new features, DevOps professionals create multiple versions of the same product with numerous release branches.
However, when it’s necessary to fix an error or a bug, developers must make changes across many release branches, a particularly intricate and meticulous task. Fortunately, there are solutions to streamline developers’ work, including DevOps cherry picking.
So, what is cherry-picking? How can you do it with Azure DevOps? We have the answers to all your questions.
What is cherry picking?
Definition
Cherry picking may mean selecting cherries in French, but what does it have to do with web development?
To understand this, let’s go back to the basics of software configuration management. When DevOps professionals create applications, they design different versions based on modifications and improvements. A branch is then created as a developmental path for a version.
Here, the tree analogy is quite fitting because a branch always has its source branch but can also be connected to other sub-branches.
The software ends up with numerous branches that can be modified or corrected based on the application’s requirements. When making changes, the DevOps expert must create a new fix branch, apply the necessary corrections, and replicate these changes to other branches.
Cherry picking precisely facilitates this replication. With this method, the developer selects the corrections and copies them to a target branch.
The cherry picking process
To help you better understand, here’s the process for creating software (with corrections) using cherry picking.
1. When the first version of the software is ready, DevOps professionals create an initial release branch.
2. If users report bugs or request improvements, developers create a new fix branch with the necessary modifications.
3. They then use cherry picking to select the fixes and apply them to the release branch.
By doing this, the bugs are corrected in various versions.
Important to note: “cherry-picking” is done on the main branch to avoid deploying a new version with the same bug.
Cherry picking, fusion, rebase: what are the differences?
Cherry picking stands apart from other methods for bug correction, such as:
- Merge: This involves combining multiple changes to create a new version of the software.
- Rebase: In this method, the developer integrates changes into the target branch without altering the source branch.
Compared to these two methods, the undeniable advantage of cherry picking is the ability to apply specific changes.
How do I do cherry picking?
Cherry picking with Azure DevOps
To simplify cherry picking, Azure DevOps has an integrated feature that allows you to select changes (pull requests) in a new branch directly from a browser.
By default, this tool facilitates applying fixes to a single branch. If you need to apply them to multiple branches, you’ll need to repeat the process for each branch. Fortunately, you can use the Azure DevOps extension for multi-cherry picking.
If you’d like to learn more about how cherry picking works with Azure DevOps, don’t hesitate to explore our training options.
Other useful tools for cherry picking
In addition to cherry picking with Azure, DevOps professionals can also use other tools to copy branch commits to a target branch. Here are some other useful tools for DevOps cherry picking:
– Visual Studio 2022
– Visual Studio 2019
– Visual Studio 2017
– Git command line
These tools provide various options for cherry picking changes and making the process more efficient.
Why use cherry picking with Azure?
In order to deliver an optimal product to the end user, DevOps often creates several versions. This enables them to make continuous improvements without losing the basic structure. But to ensure that these changes are reflected in the versions, it is essential to use cherry picking with Azure DevOps.
This enables developers to :
Deploy specific functionality from one branch to another;
Copy work well done on an incorrect branch to another target branch;
Simplify cross-team collaboration on software configuration;
Correct multiple branches.