Skip to content

Instantly share code, notes, and snippets.

@armcknight
Created January 29, 2022 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save armcknight/1678520007d9f20e9a918a0ac364cfd6 to your computer and use it in GitHub Desktop.
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
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