Junior — Middle
Explain the principle of the Cherry Pick operation in version control systems.
sobes.tech AI
Answer from AI
The Cherry Pick operation in version control systems (such as Git) allows you to select a specific commit from one branch and apply its changes to another branch. This is useful when you need to transfer individual fixes or features without merging the entire branch.
Example of usage in Git:
# Switch to the branch where you want to apply the commit
git checkout target-branch
# Apply the commit by its hash
git cherry-pick <commit-hash>
Thus, cherry-pick copies changes from the selected commit, creating a new commit in the current branch with the same changes but with a new identifier.