Communicating And Documenting Better With Commit Messages
As with most of the web and mobile development community we primarily use git and Github to manage our source code for projects. The benefits of using a source control system are many, but how much value you get out of git depends largely on how effectively you use it. It's a good idea to step back from time to time and take a look how we are using our tools to see how we can improve. A recent talk about using git as a communication tool inspired us to pick up some new habits to ensure better communication in our teams.
In the ideal git workflow, developers commit small changes throughout the day rather than letting lots of changes pile up before committing. This makes merging your code with work other developers have done on the project much easier. The problem is when you’re making lots of small commits during the day, it’s easy to neglect constructing well-formed, explanatory messages for each individual commit. While it’s tempting to rush through the commit process, it’s important to think about the other members of the team and future developers working with the codebase. If for any reason down the road your changes need to be revisited, a good commit message can make the difference between immediately jumping in to build upon past discoveries and spending hours stymied investigating and making guesses.
Because commit messages are a permanent, searchable part of the project repository, it's a perfect place to document changes and explain decisions. The developer implementing a feature or a bug fix has so much context about the work they are doing just after they have completed it. The little bit of extra effort spent thoughtfully describing the commit in a couple of sentences vs. just lazily typing a few words can save tons of extra effort down the road. Take some time and examine the tools your team is using. The time you spending on improving communication always pays off. Your future self will thank you.