I'm a big fan of committing early and often. However, if you are anything like me, that means your commit history looks something like this:
added feature fixed typo oops another typo added tests fix failing test fix another failing test UGH TYPO
Fine for me alone, but not a great reference for the rest of the team when they try to figure out WTF I was doing a month or a year later. I've already written about how to rebase and squash commits before, so I won't cover that again. I do want to go a little more into why it's important to do so. Each commit message should reflect a distinct piece of work done. What I need to do now is rebase and change my commits to be more like this:
Added endpoint to return list of components Added unit tests for component index endpoint
Now, if someone does a git blame, they can get the full context of what I was doing, not just a one character typo change. It's also worth expanding out your messaging and putting more context in the description. Every team has their own style and rules, but, personally, this is my normal git workflow and I'm a huge fan.