Live data from Hacker News

My Favourite Git Commit

fatbusinessman.com

261–270 of 389 posts

Re: My Favourite Git Commit

#261
post #200

Earlier quoted context omitted.

To me, at least, the issue with that commit message is the signal-to-noise ratio. There is a lot of exposition for each piece of information. I prefer a more declarative commit message. However, from the writing, I suspect this is just due to the committer not being a native English speaker. e.g. the first paragraph doesn't lose any important information trimming it down to: "After adding a test matching the contents…

Hmmm, I've always believed that no commit should break a build, even if you're committing the fix right after. Otherwise you're going to cause problems for `git bisect` or other practices of going through the history to find where a problem may have started. Do other people commit breaking tests and then fixes?

I think this depends quite a bit on what other contributors are doing - it's one of those cases where several approaches are acceptable, but inconsistency is not.

"Commits should always build" is one doctrine I've seen. As you say, it makes bisecting and other error-analysis approaches easy. On the other hand, it risks either having large, opaque commits, or adding overhead to make intermediate commits build - possibly with flawed/meaningless behavior when they do.

Another is "the trunk should always build". In that case, you'd just squash branch commits down to logical groupings that are easy to analyze, whether or not things build. You can bisect on the trunk, but lose all guarantees about state on branches.

Finally, I've seen variations on "no commits that break the product", "no commits that make things worse", or "no committing failing tests without subsequent fixes". In this case, you can't generally commit broken builds, but can specifically add failing tests. The first rule just means "adding failing tests is ok", the second means "converting runtime bugs to failing tests is ok", and the third means "write your test and fix, but split (and ideally tag) the commits". All of these break bisect, but they guarantee the project itself won't become more broken from commit to commit, and they can help with other forms of reasoning about where bugs first occurred.

Every approach there seems viable if you stick to it. If there's no established practice, I suppose the best choice would be based on what sort of work and debugging is most likely to apply.

Re: My Favourite Git Commit

#262
post #114

OR you could just write Replace invalid ASCII char. Fixes rake error 'invalid byte sequence in US-ASCII'. I don't want your entire life story in my commit log.

This is good, I'd add: > Replace invalid ASCII char. Fixes rake error 'invalid byte sequence in US-ASCII'. See #123 So people can get the life story if they want it.

One downside to that approach: it requires your issue tracker to be stable for long periods of time. I've worked in a number of places where that's not true and you end up needing to figure out that the #123 linked by the system you're using now was actually #123 in the old system and was migrated as #456 in the current one.

There's a balance here and I especially like that this commit message has enough information to make searches really easy should you need to do something like that.

Re: My Favourite Git Commit

#263

Earlier quoted context omitted.

> I don't want your entire life story in my commit log. Why not? Where else do you want it? Is something forcing you to read the full commit log? There's no length limit on commit messages and commit messages are mostly out of the way. Most VCSes have a way to only show you the first line. So if you want summaries, that's what the first line is for. If you want the full story, that's what the body is for. Combined wi…

I think the problem isn't the length or content of the commit message, but its organization. It needs to have the most important information first. It reads as an "entire life story" because it is written in a narrative, sequential form. Better organization would make it skimmable, and later coders could only read as far as they need to.

If I'm searching commits, I'm trying to find record of what changed and when. I only want clues, and quick skimming is paramount. I want no personality. I want concise descriptive commit messages.

That said, we reference an ID from our project management software with every commit, so once I find the commit I'm looking for, I can reference it back to external documentation. I still discourage personality there as well because it can get out of hand and clutter the comments, but it's more forgivable than being on the commit itself.

Re: My Favourite Git Commit

#264
post #188

Earlier quoted context omitted.

This message says much more about the author than it does about the commit.

Yeah. People who use the term "retarded" that way are stupid, no matter how smart they are.

I disagree. Words are just words and we give them meaning. Being derogatory and unkind to mentally deficient folks is ethically wrong. Using that word in a different context to communicate frustrating imo is fine.

Re: My Favourite Git Commit

#265
post #243

I think my favorite (in terms of humor) is a commit from mpv complaining about locales and encodings. You can practically feel the committer's sheer frustration. [1] https://github.com/mpv-player/mpv/commit/1e70e82baa9193f6f02...

Oh. Locales. The remembered pain. Save a file in Notepad. Open in vi. See that it is different. Find data in the database, no clue the weird characters were originally supposed to be. And so on and so forth. I once wrote a reasonable program and sent it as a bug report to the maintainer of the Perl module DBD::File. He sent it as a bug report to BerkeleyDB. They said they never thought about it but yes, that would be…

> Oh. Locales. The remembered pain.

More like the ongoing pain.

I had to write the following just this year because SQL Server still defaults to using CP 1252 for text. The culprit? One of those damned stylized quotes that Office loves to insert for you. The code:

    def _wrap_str(value: str):
        try:
            return SqlVarChar(
                value.encode("cp1252")
            )
        except UnicodeEncodeError:
            logging.getLogger("bulk copy").exception(f"value causing error: {value}")
            raise

Re: My Favourite Git Commit

#266

> I don't want your entire life story in my commit log. Then I never want to work with you ever (or any code base you ever touched) because of your laziness and lack of experience working with huge code bases where long commit messages are life-saving. Also you don't care about your colleagues and long-term maintainability. Debugging bugs for months and weeks because of lack of proper commit messages is the most frus…

So you never want to work with... any junior dev ever? I can't think of a single person we have hired out of college who used Git well.

I love coaching smart junior engineers, and the first thing I teach them is using Git properly and the importance of good commit messages! :)

The problem is not someone not knowing how important it is but want to learn. The problem is the people with this kind of (lazy?) attitude NOT WILLING to do what is absolutely necessary in the long term.

Re: My Favourite Git Commit

#267

Earlier quoted context omitted.

…or fix the non-Unicode compatible systems that are consuming the commit messages and breaking? If they fail with an nbsp then they’re probably also going to fail with more obviously useful non-ASCII characters.

How often are non-breaking spaces purposely inserted vs accidentally? And the tools might handle them fine but will produce strange results or errors. An example is inserting a non-breaking space in a document or string. It will prevent word wrap, which might not have been the user intent. A linter that requires these spaces to be explicitly set in encoded form would avoid these issues.

I was forced to gain very intimate knowledge of a web based rich text editor that would use non-breaking space characters as markers to monitor current user selection.

Re: My Favourite Git Commit

#268

Earlier quoted context omitted.

...you're going to want me...kept away from others due to HR cringing at my presence.

You're not filtering him out of the hiring pool, he's filtering you. ;)

The real WTF is: Apparently there is a place called "Unalaska" in Alaska!

Re: My Favourite Git Commit

#269
post #95

This gives me ideas. My commits are usually short and sweet - to the point. I document my code very well, however. One of my strengths in a previous life as a Master Automobile Technician was the ability to document the entire process -- from duplication of a concern, to troubleshooting, to correction, to verification...it's literally how I got paid (which I never understood why so many automotive techs took short cu…

> I think I was told to keep commits to one line unless absolutely necessary.

The advice I've heard: Your first line should be a concise summary of the commit. This is because a lot of UIs only show the first line up front. (GitHub, git log --pretty=oneline, etc.) However, it's okay (and often encouraged) to go into further detail on subsequent lines.

Re: My Favourite Git Commit

#270
post #249

I had a similar issue with zero-width space recently. Why in the world does that character even exist?

I've used it to hint good line-break positions in a text body where the soft-hyphen does not apply.
Post reply on HN