Skip to content

Instantly share code, notes, and snippets.

@IanVaughan
Created August 16, 2018 15:58
Show Gist options
  • Save IanVaughan/c58e5ab8d8fe5b16986215245ec05835 to your computer and use it in GitHub Desktop.
Save IanVaughan/c58e5ab8d8fe5b16986215245ec05835 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Usage :
# In slack `/todo list`
# Copy output, pipe into this script
file = ARGV[0]
data = File.read(file)
# sed -e 's/.*`\(.*\)`.*/git merge --no-edit --no-ff origin\/\1/'
FIND = /.*`(.*)`.*/
REPLACE = 'git merge --no-edit --no-ff origin/\1'.freeze
cmds = []
cmds << 'git reset origin/master --hard'
cmds << data.split("\n").map { |l| l.sub FIND, REPLACE }
puts cmds
# WIP
# cmds.each do |cmd|
# puts cmd
# system(cmd)
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment