Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Cherry pick a patch, even if the file has been renamed.
set -eux
git clone /tmp/cherry_pick_demo
cd /tmp/cherry_pick_demo
# starts a dev branch
git checkout -B dev origin/master
git mv community/vmware/plugins/modules/ ansible/vmware/plugins/modules/
# mock some extra changes to fix the module
sed -i 's,destroy_dvswitch,remove_dvswitch,g' ansible/vmware/plugins/modules/
git commit -a -m "promotion of"
sed -i 's,update_dvswitch,update_dvswitch_status,g' ansible/vmware/plugins/modules/
git commit -a -m "Apply a fix that will need to be cherry-picked"
# Open up a stable branch
git checkout -B stable origin/master
# Cherry-pick the fix
git cherry-pick $(git log -1 --pretty=tformat:%H dev)
git log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment