1. 19

  2. 4

    I laughed in pain knowing where this was going. Glad you found a fix.

    1. 3

      It was nice to learn you can change the comment character - it’s a bit esoteric but maybe one day I’ll need it.

      What I found disappointing about the article was the demonstration of two practices with git commit messages that I do not like.

      1. Putting the link to a ticket as the first thing in the commit message. The first line (72 chars) is the most valuable real-estate of a commit message. You want to get a clear, concise and accurate one-liner for your commit message. This can be hard to do with the space available. Wasting part of it with ticket linkage metadata is, well, a waste. Stick it at the end of the commit message with the other metadata (signed-off-by, etc) with a “Ticket: #123456” line or similar. When I’m looking through history via –oneline and other tools that summarise via the commit title, seeing ticketing system metadata is rarely useful. It’s certainly useful to have in the commit message, just not in the title.

      2. The author noticed the problem because their rebase was aborted due to an empty commit message. As the first line was commented out, this implies that there were no other lines. Sigh. One line commit messages are rarely enough. The first line needs to be a summary of the “what”. The rest should cover the “why” and sometimes the “how”. Take a look at the Linux commit messages - they’re generally pretty good.

      1. 1

        For this reason we use GH- prefix, not only rebaser, but commit message editor also use # as a comment character.

        1. 1

          It’s worth noting that — for some rather legacy reasons — you can use the prefix GH- instead of # when autolinking issues/PRs in GitHub comments, commit messages, etc.

        2. [Comment removed by author]

          1. 3

            GitHub supports issue references that start with the repository name

            This is a bit unobvious, but the name in the name#number format is actually the owner name, not the repository name; it’s intended for cross-fork linking. (e.g. I have a fork of lobsters/lobsters at kivikakk/lobsters. If you’re making a comment in the lobsters-owned repo and want to refer to issue number 123 in my fork, you can write kivikakk#123.) You’ll need to use the full owner/name#number format if the repository name differs.

            1. 2

              Teach me to learn the interface by poking around lobsters/lobsters, bors-ng/bors-ng, and discourse/discourse 😅

              So, okay, you get to use owner#17 and owner/repository#17

          2. 1

            My first thought was “how did you start your commit messages with #, when that’s the comment character; is there some weird way to escape it, and why bother?”. Then I remembered that git can be used without magit :P

            I didn’t know about the default comment character choice, but stuff like that smells really off to me. I get why it’s there, but I wouldn’t like to be pushing things that far from ‘single responsibility’. I also think enabling “auto” features by default would break the principle of least surprise; maybe better to have it look through the commit history.