Skip to content

Instantly share code, notes, and snippets.

@deathbob
Created August 18, 2010 15:39
Show Gist options
  • Select an option

  • Save deathbob/535174 to your computer and use it in GitHub Desktop.

Select an option

Save deathbob/535174 to your computer and use it in GitHub Desktop.
namespace :git do
desc "do a Git commit"
task :commit do
if ENV['commit'].nil?
else
commit_message = ENV['commit'].to_s
# bangle face
puts `clear`
puts `git status`
puts %x{git add .}
puts `git status`
puts %x{git commit -m "#{commit_message}"}
puts `git checkout master`
puts `git pull github master`
puts `git merge asdf`
puts `git push github master`
puts `git checkout asdf`
puts `git rebase master`
end
end
desc "create your branch"
task :create_branch do
if ENV['branch'].nil?
else
`git checkout -b ENV['branch']`
open("#{RAILS_ROOT}/lib/tasks/git.rake", 'r+') do |file|
lines = file.readlines
lines.each do |line|
line.gsub!('asdf',ENV['branch'])
# funnily enough, as long as you always use this, it'll gsub itself to be current LAWLZ
end
file.pos = 0
file.print lines
# file.truncate(file.pos) # not necessary ?
#L2 quine
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment