Skip to content

Instantly share code, notes, and snippets.

@searls
Created November 16, 2023 02:11
Show Gist options
  • Save searls/7a54ba1efc3733f7e2ce9c0000718e7d to your computer and use it in GitHub Desktop.
Save searls/7a54ba1efc3733f7e2ce9c0000718e7d to your computer and use it in GitHub Desktop.
I got sick of going through multiple steps to visit the current directory's github URL when I'm looking at a terminal, but I don't necessarily want to install `gh` or `hub` just for this feature.
#!/usr/bin/env ruby
begin
repo = `git remote -v`.split("\n").find { |line|
line.include?("github.com")
}.split("\t")[1].match(/git@github.com:(.*).git/)[1]
system "open https://github.com/#{repo}"
rescue
warn "No github remote found"
exit 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment