Git cherry-picking is a feature in Git that allows you to select and apply specific commits from one branch to another, rather than merging the entire branch. This can be useful when you want to apply a specific change or fix to a different branch, without merging the entire branch.
Imagine the following situation, you are working on a feature branch, and you have added an API (in the commit F0) in your current feature branch that might be needed in the master branch or other feature branches, so you can apply that hot-fix without applying other changes. In the following, we want to have the changes regarding the F0 from the feature branch in the master branch, so once we are in the master branch we find the hash for the commit that we need and then:
1 2 |
git log git cherry-pick <HASH-ID> |