- You can use a bug report to track the entire story of a bug/feature/refactoring, adding context such as the original problem description, the design discussions between the team, and the commits that are used to solve the problem. This lets you easily see all related commits in one place, and allows others to easily keep track of the status of a particular problem.
- Most commits should reference a bug report. Standalone commits (e.g. one-time cleanups or other small unplanned changes) don't need their own bug report, though, since they often contain all their context within the description and the source changes.
Informative commit messages and bug reports go hand-in-hand, providing context from different perspectives. Keep in mind that such context can be useful even to yourself, providing an easy reminder about the work you did last week, last quarter, or even last year. Future you will thank past you!
Is there any advice on how to handle the "Code review fixes" commit or the "Remove dead code" commits?
ReplyDeleteUsually I like to squash the "Code review fixes" prior to merging. However, I'm not really sure how to handle the tiny commits like the "Remove dead code" as I feel that they should be logically a different commit.
"Code review fixes" I would normally squash. At Google, we use Piper which is Perforce-like, so code review commits are essentially amended rather than than a new commit made, so it's squashed by default.
Delete"Remove dead code" I would keep as a separate commit. All Code Health guidance are never really rules that apply everywhere. Indeed, you'll find some guidance in tension with other guidance and you'll need to figure out the best way forward. One thing that *is* useful in a "Remove dead code" commit message is *how* was the dead code identified? Was there a specific tool used? That way if code that wasn't dead got removed and a rollback needed, you'd know where to start looking to make sure it doesn't happen again.
I do a lot of code review fixes commit but add longer description with itemized message on what I did.
Delete