Skip to content

Instantly share code, notes, and snippets.

@buren
Created February 12, 2020 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buren/60b5a42aefeb5dcc6c35948835662018 to your computer and use it in GitHub Desktop.
Save buren/60b5a42aefeb5dcc6c35948835662018 to your computer and use it in GitHub Desktop.
# USAGE
# In any local GitHub repository run
# $ github_open
github_open() {
local remotename="${@:-origin}"
local remote="$(git remote -v | awk '/^'"$remotename"'.*\(push\)$/ {print $2}')"
[[ "$remote" ]] || return
local user_repo="$(echo "$remote" | perl -pe 's/.*://;s/\.git$//')"
open "https://github.com/$user_repo"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment