| There's an infinite amount of detail that's impossible to capture in a comment and which invariably changes over time and doesn't hold in the future. For my team, the solution has been writing longer commit messages detailing not only what has changed, but also the why and other considerations, potential pitfalls and so forth. So in this case, a good commit message might read like: ```
Created square root approximation function This is needed for rendering new polygons in renderer Foo
in an efficient way as those don't need high degree of accuracy. The algorithm used was Newton-Raphson approximation, accuracy was
chosen by initial testing: [[Test code here showing why a thing was chosen]] Potential pitfalls here include foo and bar. X and Y were also
considered, but left out due to unclear benefit over the simpler
algorithm.
``` With an editor with good `git blame` support (or using github to dig through the layers) this gives me a lot of confidence about reading code as I can go back in time and read what the author was thinking about originally. This way I can evaluate properly if conditions have changed, rather than worry about the next Chthulu comment that does not apply. |