-
-
Save imambungo/6aec26ddc4eff6aeaaea0acc1256cc42 to your computer and use it in GitHub Desktop.
Open GitHub URL for current directory/repo...
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
#!/usr/bin/env bash | |
# usage: gh [file] | |
gh() { | |
repoURL=$(git config remote.origin.url | sed "s~git@\(.*\):\(.*\)~https://\1/\2~" | sed "s~\(.*\).git\$~\1~") | |
branch=$(git branch | grep \* | cut -d ' ' -f2) | |
relativePath=$(git rev-parse --show-prefix) | |
google-chrome "$repoURL/tree/$branch/$relativePath$1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment