Skip to content

Instantly share code, notes, and snippets.

@effata
Created January 18, 2012 12:50
Show Gist options
  • Save effata/1632857 to your computer and use it in GitHub Desktop.
Save effata/1632857 to your computer and use it in GitHub Desktop.
git-push-staging
#!/usr/bin/env ruby
def exec cmd
puts cmd
system cmd or abort unless $fake
end
head = `git symbolic-ref HEAD`.chomp.gsub(/refs\/heads\//, "")
branch = (ARGV.shift || head).gsub(/refs\/heads\//, "")
remote = ARGV.shift || "origin"
exec "git push -f #{remote} #{branch}:staging"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment