Last active
December 21, 2015 01:38
-
-
Save derekkraan/6228744 to your computer and use it in GitHub Desktop.
Cherry-pick many commits
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
# cherry-pick many commits | |
# call with one (optional) argument: the short-hash of the commit in the list that you want to start *after* | |
# eg: | |
# $ ruby rebase.rb | |
# (half of the commits apply, but then you have to fix one manually; the last commit you applied is abc123) | |
# $ ruby rebase.rb abc123 | |
# (the rest of the commits are cherry-picked) | |
hashes = ["41ae018", "610f707"] | |
current_hash = ARGV.first | |
if current_index = hashes.index(current_hash) | |
hashes.slice!(0, current_index + 1) | |
end | |
hashes.each do |hash| | |
cmd = "git cherry-pick #{hash}" | |
puts "> #{cmd}" | |
exit unless system cmd | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment