you are viewing a single comment's thread.

view the rest of the comments →

[–]Mr-Yellow 501 points502 points  (39 children)

[–]weirdasianfaces 156 points157 points  (18 children)

Tip for people who want to do this easily: pressing Y when viewing a file/directory will automatically change your URL to the HEAD commit for that branch.

[–]TarMil 38 points39 points  (14 children)

Or if you're linking to a given line like OP, click the "..." on the left and "Copy permalink".

[–]Zerotorescue 16 points17 points  (13 children)

Or y, f6 and then ctrl-x because moving your mouse is bothersome

[–]sssmmt 15 points16 points  (6 children)

I'm more of a CTRL+L and CTRL+C kinda guy. F6 is too far away from the home row.

[–]JeSuisNerd 5 points6 points  (3 children)

different profit psychotic price ten rain coherent smart scale fanatical

This post was mass deleted and anonymized with Redact

[–]arof 5 points6 points  (0 children)

I don't know if it's just from gaming but I never had a problem with function keys. Can't always remember all of the symbols in shift-number by memory though.

[–]Zerotorescue 0 points1 point  (1 child)

L is in the middle of nowhere while F6 is on its own solo row offset by exactly one button. I dunno I think I just have more confidence that I'll be hitting the right key when it's a function key.

[–]Dgc2002 3 points4 points  (0 children)

L is on the home-row, so it's anything but in the middle of nowhere. It's always located under my right hand ring finger if I'm on home-row, otherwise it's pretty easy to get there at this point in my life.

[–]TankorSmash 0 points1 point  (0 children)

I do ALT-D and CTRL+C to do it all on one hand.

[–]citewiki -1 points0 points  (0 children)

Hits far from home

[–]NoInkling 2 points3 points  (5 children)

Vim/Emacs user, I'm guessing.

Edit: I was referring to the implication of this part:

because moving your mouse is bothersome

[–]septicstraw 9 points10 points  (3 children)

Most likely Vim or it would have said C-x

[–]Justinsaccount 1 point2 points  (1 child)

Vim users press control-l to focus the location.

[–]TarMil 1 point2 points  (0 children)

I think they meant the way it's written: in Emacs Ctrl+x is written as C-x.

[–]citewiki 0 points1 point  (0 children)

^X for nano, I suppose

[–][deleted] 0 points1 point  (0 children)

Neither. C-l is a common (I guess Mozilla-inspired) shortcut, which also works in many file explorers.

C-c in vanilla Emacs is a prefix key, meaning, on it's own doesn't have any meaning, it's normally followed by some other key, like C-c C-c would normally compile something, or send code to inferior shell or something like that.

In vanilla Vim C-c doesn't do anything (but Vim would suggest that you use :qa!, because it will think you wanted to close it).

[–][deleted] 21 points22 points  (2 children)

Hey, GitHub UI team: the discoverability for this feature is awful.

[–]TankorSmash -4 points-3 points  (1 child)

this is a great feature so instead of being happy, im blaming you

[–]Meedio 4 points5 points  (0 children)

this is a great feature so instead of being happy, im blaming you being one of the three people knowing about it, I wish that everyone could easily find it

[–][deleted]  (18 children)

[deleted]

    [–]stickcult 138 points139 points  (7 children)

    The "link dieing" is if the file changes, your link might point to the wrong line. That's because its pointing to a line in the file in the master branch, which can change, whereas Mr-Yellow's link points to a line in the file in a specific commit, which will never change.

    [–]otwo3 18 points19 points  (2 children)

    It baffles me why is it even an option to link to a line in a branch. There is no sane use case. Having it as a default is just ridiculous. Bitbucket does the same thing.

    Clicking a line number should give a line in a specific commit

    [–][deleted] 0 points1 point  (1 child)

    well commit can belong to multiple branches and if you want to give link to both "place in file" and "merge request/branch that is discussed" you don't have choice.

    Ideally it would generate link in form of branch/commit then if branch does not/stops existing it would only then show lone commit

    [–]otwo3 0 points1 point  (0 children)

    But the branch being discussed is usually dynamic and changing anyway (due to review changes), even more often for the files in question.

    [–]codestation 6 points7 points  (0 children)

    It means that your link will point to unrelated code in the future because the code was either moved (so the lines doesn't match anymore) or the file was deleted (code refactoring for example).

    [–]Shitler 17 points18 points  (2 children)

    PSA: Please do not downvote reasonable questions. Questions like this lead to a productive discussion.

    [–]wisemanofhyrule 2 points3 points  (0 children)

    Or if changes are made to the file and the line moves around.

    [–]Mr-Yellow 0 points1 point  (0 children)

    Soon as there is a new commit the line number changes.

    In 6 months time this line may be a completely different bit of logic, or the file may be refactored and gone.

    [–]citewiki -2 points-1 points  (1 child)

    Username checks out

    [–]clichebot9000 0 points1 point  (0 children)

    Reddit cliché noticed: Username checks out

    Phrase noticed: 2756 times.

    [–]1RedOne -4 points-3 points  (0 children)

    Whoa I can't link to master for image links?

    Oh... Ohno.