Skip to content

Instantly share code, notes, and snippets.

@neilmock
Created January 2, 2009 21:09
Show Gist options
  • Save neilmock/42699 to your computer and use it in GitHub Desktop.
Save neilmock/42699 to your computer and use it in GitHub Desktop.
namespace :git do
desc "hack"
task :hack, [:target_branch] do |t, args|
require 'git'
# assume current working directory
g = Git.open('.')
args.with_defaults(:target_branch => "master")
current_branch = g.current_branch
`git checkout #{args.target_branch}`
`git pull origin #{args.target_branch}`
`git checkout #{current_branch}`
`git rebase #{args.target_branch}`
end
desc "ship"
task :ship, [:target_branch] do |t, args|
require 'git'
# assume current working directory
g = Git.open('.')
args.with_defaults(:target_branch => "master")
current_branch = g.current_branch
`git checkout #{args.target_branch}`
`git merge #{current_branch}`
`git push origin #{args.target_branch}`
`git checkout #{current_branch}`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment