I recently learned that, as of v0.4.7, Forge’s forge-copy-url-at-point-as-kill command works on files and regions (like git-link). That is, when visiting a file inside a git repo, forge-copy-url-at-point-as-kill will copy a (web) link to the current file if the region isn’t active and will copy a permalink to the selected lines if the region is active. This completely replaces the git-link package for me.

Even better, because it’s a part of the Magit family:

  • It can copy links to commits in Magit’s blame buffers, log buffers, etc.
  • When visiting a file at a specific commit (e.g., by pressing RET on a diff hunk or a Magit blame section), it copies links at the commit in question.
  • It works in Magit status buffers, etc.

The downside is that it doesn’t integrate with VC, but if you’re using Magit that’s not going to be an issue for you.