Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def try(cmd)
puts cmd
success = system(cmd)
raise unless success
def current_commit()
`git rev-parse head`.chomp
old_commit = ARGV[0]
raise "usage: `./update.rb <commit you want to update>" unless old_commit
tip = current_commit()
try("git add --all && git checkout #{old_commit} && git commit --amend --no-edit")
new_commit = current_commit()
try("git checkout - && git rebase --onto #{new_commit} #{old_commit}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment