Skip to content

Instantly share code, notes, and snippets.

@csexton
Last active August 29, 2015 14:10
Show Gist options
  • Save csexton/0249215a0ef62e09cacb to your computer and use it in GitHub Desktop.
Save csexton/0249215a0ef62e09cacb to your computer and use it in GitHub Desktop.

Drop the following script into your path somewhere, I keep it in ~/bin.

Then add a git alias for bro

git config --global alias.bro !git-browse
#!/usr/bin/env ruby
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/, '\1')
repo_url = "#{repo_url}/tree/#{branch}"
`open #{repo_url}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment