Show Your Work
This really could have had a lot of titles, but I wanted to talk about sourcing information that you use and relay to other people.
I really try to write down as much of what I learn as I can because one of the things that I’m very worried about it is passing along information that’s not vetted and that I’m sure about. If I don’t have first-hand knowledge of something I’ll make sure I either let the person know before I tell them or it’ll come immediately after.
I was working with a colleague last week and I was watching them make some
commits to clear some of my backlog (which was incredibly sweet of them!). They
had created a branch in the form of feature/feature-name-here
which would
work fine, but would be a little out of place here because the format is a bit
different (includes the Jira ticket number).
So when he was writing his commit, I was keeping a look out for anything else that wasn’t quite in line with the rest of the commits and it was something like this:
fix(context): Add something to something else
More detail here something something something else and something
else here.
Issue: [issue number here]
I said something about how the commits I make that first line all lowercase. As soon as it came out of my mouth I thought to myself “Did I read that somewhere? I don’t think I read that anywhere…”
And it turns out I didn’t. This was one of the things I did just because that’s what a bunch of other people did. And that’s not a bad thing, it just means it’s something I’ve been doing to be consistent with everyone else. But if that’s why I’m doing it I want to include that in the suggestion.
So as soon as I realized it I said “Wait, actually, let me make sure that’s true before you change anything.”
I went to the Conventional Commits site and scrolled down to the FAQ:
Q: Are the types in the commit title uppercase or lowercase?
A: Any casing may be used, but it’s best to be consistent.
Then I came across How to Write a Git Commit Message by cbeams which had a satisfying list of “7 rules of a great Git commit message.”
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. how
That actually makes me very happy because the first time I had to write ‘id’ in lowercase broke my heart. But I wanted to be consistent and I did it. Now I can start the line with an uppercase and sprinkle the appropriate case throughout.
Happy times!