How can I apply part of a commit from one branch to another? I understand that I can cherry-pick a commit, but I need to go one step further and “cherry pick” some of the changes introduced by that commit and apply them to another (target) branch.
Is there a clean way to do this, or should I just apply the entire commit, manually undo some hunks, and remember to create more atomic commits in the future?
git cherry-pick -n <SHA>will stage the changes but not commit them. You can then usegit reset -pto unstage the bits you don’t want, orgit reset HEADandgit add -Apto stage only the changes you want.