Skip to content

Instantly share code, notes, and snippets.

@jhsu
Forked from chemmyone/git-hub-diff
Created June 2, 2010 13:39
Show Gist options
  • Save jhsu/422379 to your computer and use it in GitHub Desktop.
Save jhsu/422379 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 #{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