This command is extremely useful when you need only one or few commits from one branch in another branch, but don't want or cannot
Let'' say that in your application you use the branch
master to deploy to production and develop new code in another branch, say
dev. You implement a few features, but realize you need one of them needs to be merged to
master soon and cannot wait for you to finish whatever you were developing in the
You can use the following git commands:
# Find and copy the commit hash that you want to send to another branch git log # change to the branch where this commit is needed git checkout master # execute the cherry pick using the hash you copied earlier git cherry-pick bbb70c579ce1382af60eebacde95c2aef6676abf
If there are any conflicts, resolve them and commit the new code. Done.