Created
August 17, 2010 20:25
-
-
Save josephholsten/531853 to your computer and use it in GitHub Desktop.
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 | |
base='http://github.com' | |
if [ $1 ]; then | |
file=`git ls-files --full-name $1`; | |
fi | |
current=`git status -s -b | head -1 | cut -d' ' -f2` | |
remote=`git config branch.$current.remote` | |
if [ "$remote" = "" ] ; then | |
remote='origin' | |
fi | |
branch=`git config branch.$current.merge | sed 's/.*\/\([^\/]*\)/\1/'` | |
repo=`git remote -v | | |
awk "\\$1 ~ /$remote/ {print \\$0}" | | |
awk '$2 ~ /github/ {print $2}' | | |
head -n 1 | | |
sed 's/.*[:/]\([^/]*\)\/\([^\.]*\)\.git/\1\/\2\/blob/'` | |
url=$base/$repo/$branch/$file | |
open $url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FIXED:
TODO