4 ms·
I, too, use git commit messages to document the reasoning behind my changes. But I'm unsure if my colleagues even notice, since they regularly write bad commit
by pvorb 7y ago
I, too, use git commit messages to document the reasoning behind my changes. But I'm unsure if my colleagues even notice, since they regularly write bad commit messages like "Fix bug" and things like that. Also I regularly find my commit messages got lost, since the reviewer squashed several commits into one.
Do you have any tips for establishing a culture of good commit messages?
- optimuspaul 7y agoI usually start with being aggressive about people not squashing commits. I think it's bad form. I also find shame works, as well as blocking merges when reviewing when commit messages provide no value. Could also start a swear jar of sorts, the offender puts a dollar in whenever they push a commit with a useless message... and use the proceeds for charity rather than something that benefits the team.
- l0b0 7y agoThis requires an existing buy-in from the team. How do you establish that buy-in in the first place? I know trying to be a good citizen isn't enough, because the worst offenders simply aren't interested in the revision history.
- optimuspaul 7y agoGreat question I don't have a solid answer to. Due to my seniority I tend to either be the lead or act as the lead for teams. It is easier for me to reason with the team to buy into these kind of things. The worst offenders will tend to be weeded out over time either by changing their ways or leaving. I don't have much sympathy for them if they can't see how their actions affect others. A team has no place for a rogue agent.
- dionidium 7y ago> Also I regularly find my commit messages got lost, since the reviewer squashed several commits into one. This tendency toward nice, neat, clean, architecturally pure, and ultimately worse solutions runs deep in software engineering (and in humanity, in general (see e.g. the failure of pristine housing projects that replaced messy-but-functional slums)) and it's one I have to fight within myself, too. I don't think there's any great way to combat it, though. You need mature, experienced developers on your team who aren't too tired and burned out to fight it.
- jamietanna 7y agoWithin my team, we use Git flow with 2 person enforced code review before a merge (within a 10 person team). We use the code review to enforce this, alongside any other changes required. I'm a strong proponent of good commit messages, so one thing I've been doing since joining the team is encouraging this to be better.