What is the suggested structure for commmitting code? 1) How big should the commit be? 2) What should the comments (if any) convey about the commit?
John Merriwether
[ Editor ]
1) Commits should be small and concise as possible, especially if you do code reviews (which is a practice I recommend) but also still have meaning. Whenever a "piece" of the functionality is implemented, I'd say commit it. It also depends on your source control system. If you use Git I recommend committing to your local repository frequently since it doesn't effect the rest of the team. Finally push your commits to the master when there is a good time for that. If it's a SCM that has a "main" repository like Subversion then I'd recommend being more judicious about commits as they are always going to effect the team.
2) Commits should always have a meaningful message behind them. Always try to answer the question "why" if you are making a change, and include a bug tracking number in the commit if possible. This helps with code review and understanding "why" those changes were made.
