ben-gibson / GitLink

A Jetbrains plugin that opens a local file under Git version control in its remote host using the default browser.
https://plugins.jetbrains.com/plugin/8183-gitlink
MIT License
671 stars 58 forks source link

Feature Request : force link on default branch #307

Open mfillon opened 12 months ago

mfillon commented 12 months ago

Hey, thanks for this great plugin which helps a lot.

I often edit the generated link cause most of the time I want the URL to be as simple as possible and not include a commit hash or a specific branch name, so I replace the commit hash with my default branch name (main, dev, ...).

Would it be possible to either have a global config like "Generate link on default branch" or to have an extra menu option "Copy link with default branch"?

I realise that there's a risk the generated URL will be a 404 if the file doesn't exist on default branch or that the line nb will not reference the expected one.

remarkov commented 3 months ago

@ben-gibson maybe this feature may be included in the configuration like


Generate the URL using (in order of availability):

So user can combine any of these options, like I prefer to use current branch (don't need commit hash) and if it does not exist in remote - default repo branch so I select 1 and 3. @mfillon always needs default branch so they would select only 3 etc. Hope my idea is clear enough. WDYT?