Step 1: Save the script to some place in your $PATH
and make it executable.
Step 2: git config --global alias.bro '!git-browse'
Step 3: When everyou want to view a branch on github, just git bro
Step 1: Save the script to some place in your $PATH
and make it executable.
Step 2: git config --global alias.bro '!git-browse'
Step 3: When everyou want to view a branch on github, just git bro
#!/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}" | |
# This only works on a mac. Send pull requests! | |
`open #{repo_url}` |