Write commit messages like a boss

Big cleaning Fridays - time of the week when the number of “wtf’s/hour” drastically increases. I had to dive into some of the projects that been aside of my daily working routine for a while, and just to refresh the notion of what’s been going on up there, I’ve fired git log on the repository. Oh, how I hate commit messages like ‘minor fixture for …’ and ‘fixed typo for …’! This is how I hate it:

git log review reaction

Rule of thumb for useful and reasonable commit messages in Git (I’d say in any Version Control System though):

“Don’t tell how you did the change in the code, but write “why” the change was performed”.

At some point you might use ticket IDs in the commit message, which will bind the change to the initial request/bug, but it won’t properly specify the changes done in the code.

git log --pretty=oneline for the repository - and try to find logic in your commit messages among the project. Especially, if the request affects lots of code, ticket_id would simply group the commits but won’t tell you much about it.

Classical example of ticket_id integration - Asana and Github integration, or mentioning #branchname in Git commit for Github to bind all the diffs to corresponding branch.

For Git commit message best practices - RakeRoutes.com published really good article covering most of the do’s and don’ts.