gh permalink

Create a permalink from the CLI
Installation
gh extension install spenserblack/gh-permalink
Usage
# Permalink a file
gh permalink my-file
# Permalink a line
gh permalink my-file 1
# Permalink a range of lines
gh permalink my-file 1-5
Advanced
Permalinking Commits
This extension creates a permalink from the current HEAD commit. If you need to create a permalink
to a different commit, checkout that commit first.
git checkout v0.1.0
gh permalink my-file
# now you have a permalink to my-file at the commit tagged by v0.1.0
git checkout - # go back to where you were previously checked out
Caveats
While this can create a permalink for any commit, that permalink will
return a 404 error if the commit is not pushed. This extension doesn't
handle pushing commits for you, so you'll need to do that yourself if
you want to create a permalink to a file that may be ahead of the remote.