Skip to content

Instantly share code, notes, and snippets.

@sdavidsson90
Last active March 19, 2026 17:28
Show Gist options
  • Select an option

  • Save sdavidsson90/e0aae821c46e44b5a6c618ce9daa649a to your computer and use it in GitHub Desktop.

Select an option

Save sdavidsson90/e0aae821c46e44b5a6c618ce9daa649a to your computer and use it in GitHub Desktop.
Open remote url of the current git repo (gor = git open remote)
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