Created
January 29, 2022 00:33
-
-
Save armcknight/1678520007d9f20e9a918a0ac364cfd6 to your computer and use it in GitHub Desktop.
Fish shell function to open a file in current local git repo on GitHub's website
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
function gweb -d "view a file on GitHub's website, in the current repo and working branch" | |
set branchname (git rev-parse --abbrev-ref HEAD) | |
set repourl (git config --get remote.origin.url | sed s/\\.git// | sed 's/:/\//' | sed 's/.*github.com/https:\/\/github.com/') # h/t https://gist.github.com/richardmcmillen-examtime/7448300 | |
open $repourl/blob/$branchname/$argv[1] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment