Skip to content

Instantly share code, notes, and snippets.

@derryl
Created July 31, 2013 18:02
Show Gist options
  • Save derryl/6124475 to your computer and use it in GitHub Desktop.
Save derryl/6124475 to your computer and use it in GitHub Desktop.
Opens the GitHub website for the repo currently being viewed in Bash
#!/bin/sh
function gh() {
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//}
echo $giturl
open $giturl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment