Skip to content

Instantly share code, notes, and snippets.

@DarrenN
Forked from tylergaw/.github-open.sh
Last active August 29, 2015 14:17
Show Gist options
  • Save DarrenN/62dbeac4820d2fbb1602 to your computer and use it in GitHub Desktop.
Save DarrenN/62dbeac4820d2fbb1602 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment