Skip to content

Instantly share code, notes, and snippets.

@rtlechow
Forked from pauldowman/github-commits-listing
Created June 13, 2012 18:06
Show Gist options
  • Save rtlechow/2925568 to your computer and use it in GitHub Desktop.
Save rtlechow/2925568 to your computer and use it in GitHub Desktop.
With file and line number!
#!/bin/bash
BRANCH=`git branch | grep '^\*' | awk '{print $2}'`
DIR=`pwd`
REPO=`git remote -v | grep origin | head -1 | sed 's/[^:]*:\([^\.]*\).*/\1/'`
top_level=`git rev-parse --show-toplevel`
full_path=$PWD/$1
relative_path=${full_path#*$top_level/}
line=$2
open "https://github.com/$REPO/blob/$BRANCH/$relative_path#L$line"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment