Last active
March 19, 2026 17:28
-
-
Save sdavidsson90/e0aae821c46e44b5a6c618ce9daa649a to your computer and use it in GitHub Desktop.
Open remote url of the current git repo (gor = git open remote)
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
| gor() { | |
| # ---------------------------------------------- | |
| # gor: git open remote | |
| # Open the current repository at it's remote URL | |
| # ---------------------------------------------- | |
| git rev-parse --is-inside-work-tree >/dev/null 2>&1 || { echo "No a git repo!"; return 1; } | |
| url="$(git remote get-url origin 2>/dev/null | sed -E 's#git@([^:]+):#https://\1/#')" | |
| [[ -z "$url" ]] && | |
| { echo "No remote URL set!"; return 1; } | |
| echo "Open: $url"; open "$url" &>/dev/null | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment