Created
March 18, 2014 20:13
-
-
Save mholubowski/9628521 to your computer and use it in GitHub Desktop.
gh function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Opens the github page for the current git repository in your browser | |
# [email protected]:jasonneylon/dotfiles.git | |
# https://github.com/jasonneylon/dotfiles/ | |
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/\/tree/} | |
#branch="$(git symbolic-ref HEAD 2>/dev/null)" || | |
#branch="(unnamed branch)" # detached HEAD | |
#branch=${branch##refs/heads/} | |
#giturl=$giturl/tree/$branch | |
open $giturl | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment