Skip to content

Instantly share code, notes, and snippets.

@CrCs2O4
Created August 11, 2016 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CrCs2O4/6f4b220a4d10a6c139374e4eba6fcd72 to your computer and use it in GitHub Desktop.
Save CrCs2O4/6f4b220a4d10a6c139374e4eba6fcd72 to your computer and use it in GitHub Desktop.
Ruby magic on cherry picking whole branch with merge fast-forward problems
#!/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