Skip to content

Instantly share code, notes, and snippets.

@alexbasson
Last active August 29, 2015 14:16
Show Gist options
  • Save alexbasson/46ad72e1a313c115b948 to your computer and use it in GitHub Desktop.
Save alexbasson/46ad72e1a313c115b948 to your computer and use it in GitHub Desktop.
def system_or_exit(cmd, stdout = nil)
puts "Executing #{cmd}"
cmd += " > \"#{stdout}\"" if stdout
system(cmd) or raise "******** Build failed ********"
end
namespace :git do
desc "Merge feature branch"
task :merge do
system_or_exit 'git checkout master'
system_or_exit 'git diff origin/master..HEAD --quiet --exit-code'
system_or_exit 'git reset origin/master --hard'
system_or_exit 'git pull --rebase'
system_or_exit 'git checkout -'
system_or_exit 'git rebase master'
system_or_exit 'git checkout -'
system_or_exit 'git merge --no-ff -'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment