-
-
Save zef/7618497ed374e8f71eb2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
if remote = `git remote -v`.lines.find { |l| l.match /bitbucket/ } | |
matches = remote.match /(?<domain>bitbucket.org).(?<path>.*)\.git/ | |
url = "https://#{matches[:domain]}/#{matches[:path]}" | |
branch = `git symbolic-ref --short HEAD`.lines.first | |
url += "/branch/#{branch}" | |
system "open #{url}" | |
else | |
puts "No BitBucket remote :(" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added support for remote URLs that use the SSH format. Modified to open current branch.