-
-
Save rtlechow/2925568 to your computer and use it in GitHub Desktop.
With file and line number!
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
| #!/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