I am using git to manage a C++ project. When I am working on the projects, I find it hard to organize the changes into commits when changing things that are related to many plac
I try and follow these practices in the order...
A commit must not fail a build. Most important!
It should be made of one logical unit of change - whether a single line/character or a whole file/class with corresponding changes in other parts of code, still following #1.
What is a logical unit of change? In terms of git
, if you can specify the changes in the commit message in least number of characters, in one sentence (without ANDs of-course), and you can not break that description further into smaller units, that I call one unit.
Commit message should clearly specify the essence of the commit.
Commit message should be small, typically no greater than 80 chars. Any more elaboration should be part of the description
.