Created
October 26, 2025 18:24
-
-
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 () { | |
| is_git=$(git rev-parse --is-inside-work-tree 2>/dev/null) | |
| if [[ $is_git != true ]] | |
| then | |
| echo "This is not a git repo" | |
| return 1 | |
| fi | |
| url="$(git remote get-url origin 2>/dev/null | sed -E 's#git@([^:]+):#https://\1/#')" | |
| if [[ -z $url ]] | |
| then | |
| echo "No remote" | |
| return 1 | |
| fi | |
| 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