Repository navigation
Replies: 3 comments
|
found discussion i was thinking of: |
0 replies
|
Use gh browse cmd/gh/main.go:312 --no-browserTo print a (range) URL like GitHub's gh browse cmd/gh/main.go:10 --no-browserand then extend to Related flags:
If this is what you were looking for, please mark this comment as the answer — thanks! |
0 replies
|
I'd pin the link to a commit so it still points at the same code later: # Run inside the repository; substitute your file and line.
gh browse cmd/gh/main.go:10 --no-browser --commit="$(git rev-parse HEAD)"For a line range, replace the URL fragment: url=$(gh browse cmd/gh/main.go:10 --no-browser --commit="$(git rev-parse HEAD)") &&
printf '%s#L10-L15\n' "${url%%#*}"Change the file and line numbers to yours. Checked URL generation with gh 2.103.3 and the range replacement locally. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I swear i've seen this around somewhere in issues/discussion, but can't rediscover it.
How do you generate a reference link to a line in a file using the gh cli?
Thanks!
All reactions