Ever been in the situation where you want a change from another branch but not all? I did… and ended up merging everything and reverting all the things I didn’t need. Turns out git has a command for this! Git cherry-pick.

The official documentation can be found here. Now I will show how I use this command.

Git cherry-pick

You can take any commit you like and apply it to your branch.

git cherry-pick <commit-hash>

If you want to pick more at once you can take multiple commits.

git cherry-pick -n <commit-hash1> <commit-hash2>

With the n you don’t automatically commit the changes on your branch.

Hopefully you can add this command to your merging toolbox. Happy picking!