Created
October 19, 2010 19:45
-
-
Save rondevera/634946 to your computer and use it in GitHub Desktop.
OS X: Opens the specified file/directory in GitHub via your browser
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
| # Usage from within a Git repo: | |
| # | |
| # hubb public/javascripts/app.js | |
| # # Opens `https://github.com/<repo>/blob/<branch>/public/javascripts/app.js` | |
| # # in your browser. | |
| # | |
| # hubb | |
| # # Opens `https://github.com/<repo>` in your browser. | |
| hubb(){ | |
| repo=$(git config remote.origin.url | sed "s/^git@github\.com:\(.*\)\.git$/\1/") | |
| branch=$(cat .git/HEAD | sed "s/.*\/\(.*\)$/\1/") | |
| if [ $1 ]; then | |
| kind=$([[ $1 =~ \/$ ]] && echo "tree" || echo "blob") | |
| open "https://github.com/$repo/$kind/$branch/$1" | |
| else | |
| # Like `hub browse`: https://github.com/defunkt/hub | |
| open "https://github.com/$repo/tree/$branch" | |
| fi | |
| } |
Author
Definitely; I called it hubb as shorthand for hub browse, but with the feature I wanted.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This would make a good addition to the
git browsesub-command of hub.