Skip to content

Instantly share code, notes, and snippets.

@sdavidsson90
Created October 26, 2025 18:24
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 () {
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