Created
December 29, 2011 19:59
-
-
Save cvan/1535938 to your computer and use it in GitHub Desktop.
open file on github in browser
This file contains 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
#!/bin/sh | |
# Usage: `git examine <url>` | |
# | |
# * opens the github page if it found the file | |
# | |
# Only for the Mac. | |
if [[ $1 ]]; then | |
FILE=$1 | |
else | |
FILE='' | |
fi | |
ROOT=$(git config remote.origin.url | perl -pi -e 's%^.*:(.*).git%https://github.com/\1/blob/master%') | |
echo $ROOT/$FILE '\c' | pbcopy | |
echo $FILE | |
# Open the browser. | |
open $ROOT/$FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is awesome, thanks!