How to properly reference online hosted Git code

General Modding Information/Questions; support/discussion/questions

Moderator: thunderchero

Forum rules
:idea: Please search before starting new topic. :idea:
There is a good chance it has already been asked.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3258
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany

How to properly reference online hosted Git code

Post by Flocke »

As this is a usual issue that will raise for sure, let me add a note on proper code links to public git repositories hosted on GitLab or GitHub or the like.

This is a proper link to some git file location with specified commit number:
https://gitlab.com/stbotf/ultimate-editor/-/blob/33e0fb8ccc0523909b2984ce23772b510df4c595/source/ue/UE.java#L106

This is NOT a proper link to some git file location cause it lacks the commit number:
https://gitlab.com/stbotf/ultimate-editor/-/blob/master/source/ue/UE.java#L106

The latter breaks as soon someone pushes a new commit to the master branch, altering the line numbers. So please if you reference some code line, either browse files at a specific commit, usually the last commit of the master branch, or find some permalink button like this one:
permalink.jpg
For including the line number btw you just need to click the line numbers to the left of the file. It will highlight that line and auto-scroll when you enter the link.

thx :)
You do not have the required permissions to view the files attached to this post.

Return to “General Modding Information/Questions”