News for hackers. Stuff that matters.
Re:Commit messages guide by MrBuddyCasino on Saturday April 20, 2019 @06:45AM (#19705810)
I don’t understand why the history of the code matters so much to some people. Give me well designed and commented (!) code, with tests, designed to be understood by humans. Thats a bar few code bases clear, if I need to look at the git history its a sign the code is crap and I have to use all the information that I can get, with history being my least favorite because it has shitty UX (discoverability, navigation).
Re:Commit messages guide by int_19h on Saturday April 20, 2019 @10:50PM (#19710278)
As time passes, practically no actively maintained codebase is going to clear your bar. It's going to pass through several different teams, with different policies and standards. Eventually, parts of it are going to be put on life support, which generally means an understaffed team that scrambles to patch up the most egregious bugs, often with dirty hacks, because they have no time and resources to do massive rewrites that are necessary to fix things properly. Maintaining such codebases requires a lot of "code archeology", and good history makes it much, much easier.
Re:Commit messages guide by MrBuddyCasino on Sunday April 21, 2019 @02:07AM (#19710759)
Not sure I get your point. People will cut corners and mess up the code, but somehow the history could be excempt from this?
Re:Commit messages guide by schroffl on Saturday April 20, 2019 @10:26AM (#19706661)
Having properly separated and single-purpose commits is awesome when running `git bisect` [1] — especially with automatic tests. As well when you revert said commits after the offender is found.

[1]: https://git-scm.com/docs/git-bisect

Re:Commit messages guide by marcinzm on Saturday April 20, 2019 @11:10AM (#19706916)
If you're using a CI that runs on every PR/master merge wouldn't it catch this without the need for git-bisect?
Re:Commit messages guide by int_19h on Saturday April 20, 2019 @10:40PM (#19710256)
Only if your tests have perfect coverage. And by "perfect" I don't mean lines or branches, but program states.
Re:Commit messages guide by u801e on Saturday April 20, 2019 @11:19AM (#19706972)
> I don’t understand why the history of the code matters so much to some people.

Having the git blame output of the line I'm changing is very helpful when determining the potential consequences of changing that line. If the history doesn't matter, then why bother with commit messages at all. You could essentially script your editor to run "git commit -a --allow-empty --allow-empty-message" every time you write the files to disk.

Re:Commit messages guide by MrBuddyCasino on Saturday April 20, 2019 @03:17PM (#19708359)
Our workflow is: - branch - commit first version, open Github PR with a text describing the PR, which is usually longer than the git commit message and contains links to notion pages and other things detailing the design - reviewers look at the code, and there is some to and fro with smaller commits until the PR is fine - code gets merged

So the main action happens outside of git. Maybe for other workflows git commit messages are more important.

Re:Commit messages guide by marcinzm on Saturday April 20, 2019 @11:07AM (#19706894)
>commented (!) code,

Comments become stale and will often not be updated as the code changes.

Re:Commit messages guide by MrBuddyCasino on Saturday April 20, 2019 @03:18PM (#19708366)
This is what code reviews are for. Why would you exclude comments from that? It certainly doesn't happen in our team.
Re:Commit messages guide by patrec on Sunday April 21, 2019 @05:02AM (#19711256)
Comments often refer to stuff that's not directly in the "review window" i.e. the actual diff plus additional context you'll see in a typical code review setup.

So even if people are conscientious about reviewing comment changes (and absence thereof!), too this often gets missed.