Copy GitLab link for the active file to the clipboard - permalink vs master

Problem to solve

I used to share files (mainly markdown notes) stored in a git repository in GitLab.com with colleagues. I found this really useful especially for people "outside" GitLab itself (when project is public, of course)

Unfortunately, with standard Copy Link to Active File in GitLab command you got

  • permalink
  • the current line position selected

The former is annoying when your documentation is in progress and you would like people to reference to latest main version (or maybe a specific branch)

The latter force GitLab showing the Markdown source code instead of rendered page

I'm used to:

  • run Copy Link to Active File in GitLab command
  • paste link
  • change permalink SHA to main (or master.. and I always mistake this 😅 )
  • remove trailing line reference

Proposal

Split the existing GitLab: Copy Link to active file to two commands:

  • GitLab: Copy Link to active file (permalink)
  • GitLab: Copy Link to active file (current branch)

This will allow the user to pick which option they want.

For starters, let's not remove the line range fragment, we can do that in future iterations.

Original great proposal from @andreascian

So, I suggest to have:

  • either a configuration option for link sharing (permalink or not, with/without line number)
  • or additional command, e.g.
    • GitLab: Copy Link to active file, which is the current permalink implementation (will it be useful to specify as GitLab: Copy Link to active file (permalink)?
    • GitLab: Copy Link to active file (current branch). Line number here does not make sense IMHO

Implementation notes

follow the CONTRIBUTING.md to setup the project, find out more about our testing and architecture in docs/dev folder.

Further details

I think that directly allow to:

  • use current branch instead of permalink
  • avoid reference to specific line

may help also others and improve this (really useful, IMHO) functionality

Links / references

  • this is related to #209 (closed) and especially to this comment
  • maybe the first version of this command was not permalink and something changed during development 🤔
Edited by Tomas Vik (OOO back on 2026-01-05)