Skip to content

Instantly share code, notes, and snippets.

@cvan
Created December 29, 2011 19:59
Show Gist options
  • Save cvan/1535938 to your computer and use it in GitHub Desktop.
Save cvan/1535938 to your computer and use it in GitHub Desktop.
open file on github in browser
#!/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
@kumar303
Copy link

this is awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment