Created
August 11, 2016 07:39
-
-
Save CrCs2O4/6f4b220a4d10a6c139374e4eba6fcd72 to your computer and use it in GitHub Desktop.
Ruby magic on cherry picking whole branch with merge fast-forward problems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def system!(*args) | |
system(*args) || abort("\n== Command #{args} failed ==") | |
end | |
# you need to change this :) | |
commits = %w(a3d2f06 5a7867b f732f0c 1ae71c7 43c2c18 04d4e3c f477de2 446558e eec5628 2a8ea6a 8143565 4d54f04 87e04e2 4b6d641 0cdb2a6 de5af95) | |
# reverse because we need to cherry-pick commits first-last | |
commits.reverse.each do |commit| | |
system! "git cherry-pick --allow-empty --keep-redundant-commits --strategy=recursive -X theirs #{commit}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment