Skip to content

Instantly share code, notes, and snippets.

@tyrelsouza
Last active April 18, 2017 17:34
Show Gist options
  • Save tyrelsouza/92af587363424b3051b30105ee7a8928 to your computer and use it in GitHub Desktop.
Save tyrelsouza/92af587363424b3051b30105ee7a8928 to your computer and use it in GitHub Desktop.
function GitHub()
{
if [ ! -d .git ] ;
then echo "ERROR: This isnt a git directory" && return false;
fi
git_url=`git config --get remote.origin.url`
if [[ $git_url == https://github* ]];
then
url=${git_url%.git}
else
if [[ $git_url == [email protected]* ]]
then
url="https://github.com/${${git_url:15}%.git}"
else
echo "ERROR: Remote origin is invalid" && return false;
fi
fi
open $url
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment