Which style do you use for your commit messages? Technical or feature-based?
Lets say you are working on a some type of web applications. Here are the 2 different versions of commit messages for the same change set.
- Redirect user to user_profile for public controllers -or- Restrict logged in user acces to public controllers
- Add require_guest before filter to necessary controllers
The first one explains what is the result of this change and the second one basically explains how you achieved this or what you have changed.
So which one do you prefer? and why?
3 Solutions collect form web for “Which style do you use for your commit messages? Technical or feature-based?”
DRY applies for commit messages, so don’t repeat anything that you can see from the code/diff.
Create context instead: Mention the ticket number which caused the change, explain why you did it, give a 10’000 feet view of the change.
Example: “Make sure only verified users can access private pages” instead of “Added calls to AccessController”. I can see the latter from the diff but the diff doesn’t explain why you did the change.
I’d rather have a commit message that mentions both ends of the connection:
New require_guest before filter redirects users to user_profile for public controllers
you should probably mention both, and also a ticket number, in case you use something like Trac or RedMine