Commit variables instead of each file.
This has the following advantages:
- You can see why this single line was changed in this exact file (aha, this was a fix for bug No. 123). If you commit a per file, commit messages tend to describe the changes made to the file that you can see with diff anyway. If you commit for a change, then commit messages usually explain why the change was made in the first place.
- It is much easier to return or merge corrections / corrections.
- This helps to organize your work better, since you clearly focus on the one error / function / change that you are working on. You finish when you're done.
Some people think that this policy produces more commits, but from my experience you get fewer commits in the end. For example, you are doing refactoring that affects 50 files. After refactoring, you have one message with the message "Refactored xyz subsystem."
For larger changes, you should consider the dev-branch-per-change policy.
Vilmantas Baranauskas Sep 23 '08 at 7:12 2008-09-23 07:12
source share