Last Updated: January 20, 2020
·
1.187K
· thomax

Browse your current repo on github.com

The http://defunkt.io/hub/ git wrapper was bogging down my console, and the only part of it I really used was git browse. So I slapped this thing together. It figures out the URL for the git repo and branch you are currently on, and points your default browser in that direction.

repo = `git config --get remote.origin.url`.strip
branch = `git branch | sed -n '/\* /s///p'`.strip
repo_url = repo.sub(':', '/').sub('git@', 'https://').sub('.git', '')
repo_url = "#{repo_url}/tree/#{branch}"
puts repo_url
`open #{repo_url}`

Alias it from your .bash_profile or somesuch, yo.

2 Responses
Add your response

over 1 year ago ·

@afeld Thanks for the tip! Will check it out!

over 1 year ago ·