Skip to content

Instantly share code, notes, and snippets.

@chemmyone
Forked from erithmetic/git-hub-diff
Created May 30, 2010 15:12
Show Gist options
  • Save chemmyone/419096 to your computer and use it in GitHub Desktop.
Save chemmyone/419096 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
# Usage:
# cd /git/project/directory
# git hub-diff 223d60f5486075e74851075fcfeb366d45c17d8b 13c86f00cbfe820c415b46bfd19268284db2a274
# Future features:
# * generate SHAs from refs
# * launchy support
require 'rubygems'
require 'git'
require 'uri'
repo = Git.open(Dir.pwd)
github = repo.remotes.find { |r| r.url =~ /github/ }
http_uri = github.url.sub(/(.*)github\.com/,'http://github.com').
sub(/\.git$/,'').
sub(/github\.com:/,'github.com/')
exec("open -a Safari #{http_uri}/compare/#{ARGV[0]}...#{ARGV[1]}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment