Skip to content

Instantly share code, notes, and snippets.

@tylergaw
Created March 27, 2015 21:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tylergaw/f9640c7f7050a206dced to your computer and use it in GitHub Desktop.
Save tylergaw/f9640c7f7050a206dced to your computer and use it in GitHub Desktop.
#!/bin/sh
git rev-parse 2>/dev/null
if [[ $? != 0 ]]
then
echo "Not a git repo"
return
fi
remote="origin"
if [ ! -z "$1" ]
then
remote="$1"
fi
remote_url="remote.${remote}.url"
giturl=$(git config --get $remote_url)
if [ -z "$giturl" ]
then
echo "$remote_url not set"
return
fi
giturl=${giturl/git\@github\.com\:/https://github.com/}
giturl=${giturl%\.git}
open $giturl
return
@tylergaw
Copy link
Author

I drop this in my home folder and then have an alias in my bash_profile

alias gh=". ~/.github-open.sh"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment