Skip to content

Instantly share code, notes, and snippets.

@bbelderbos
Created April 27, 2023 13:47
Show Gist options
  • Save bbelderbos/1bd40a146c5562adb82a6f9b7e441aa9 to your computer and use it in GitHub Desktop.
Save bbelderbos/1bd40a146c5562adb82a6f9b7e441aa9 to your computer and use it in GitHub Desktop.
function openrepo {
url="$(git remote get-url origin)"
open "https://github.com/$(echo "$url" | sed 's,.*github.com[:/],,')"
}
@bbelderbos
Copy link
Author

This also works nicely, relying on the sed not matching an https remote:

function openrepo {
  url=$(git remote get-url origin| sed 's,git@github.com:,https://github.com/,')
  open $url
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment