GitHubのレポジトリをコマンドラインから開く

http://jasonneylon.wordpress.com/2011/04/22/opening-github-in-your-browser-from-the-terminal/
以下を/usr/local/bin/github-openに保存

giturl=$(git config --get remote.origin.url)
 if [ "$giturl" == "" ]
   then
    echo "Not a git repository or no remote.origin.url set"
    exit 1;
 fi

 giturl=${giturl/git\@github\.com\:/https://github.com/}
 giturl=${giturl/\.git}
 branch="$(git symbolic-ref HEAD 2>/dev/null)" ||
 branch="(unnamed branch)"     # detached HEAD
 branch=${branch##refs/heads/}
 giturl=$giturl/tree/$branch
 open $giturl