Skip to content

Instantly share code, notes, and snippets.

@itspriddle
Created July 2, 2010 23:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itspriddle/462049 to your computer and use it in GitHub Desktop.
Save itspriddle/462049 to your computer and use it in GitHub Desktop.
[alias]
# git browse
# Opens origin in web browser
#
# Ex:
# git@myhostname.com:my/repo.git => http://myhostname.com/my/repo
# git://myhostname.com/my/repo.git => http://myhostname.com/my/repo
# http[s]://myhostname.com/my/repo.git => http://myhostname.com/my/repo
browse = !open $( \
echo \"`git config remote.origin.url`\" | \
ruby -e \"url = ARGF.read\" \
-e \"url.sub!(%r{^(git(://|@)|http(s?)://)}, '')\" \
-e \"url.sub!(':', '/')\" \
-e \"url.sub!(/\\.git\\$/, '')\" \
-e \"print 'http://' + url\" \
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment