Skip to content

Instantly share code, notes, and snippets.

@jhafner
Created May 16, 2013 15:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jhafner/5592795 to your computer and use it in GitHub Desktop.
Save jhafner/5592795 to your computer and use it in GitHub Desktop.
Open the current repo on Github. Script by Brian Edgerton.
#!/bin/bash
git_host='git@github.com:'
git_url='https://github.com/'
remote=`git config --get remote.origin.url`
host=${remote:0:15}
if [ $host = $git_host ]
then
url=${remote/$git_host/$git_url}
open $url
else
echo "Repo does not have a Github origin"
fi
@jhafner
Copy link
Author

jhafner commented Jun 10, 2013

Also, I highly recommend the following in your .bash_profile:

alias go="git open.sh"

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