Technical communication
Version control and commit messages
Also called: git commit · commit message · version control · changelog
Definition
Version control records every change to a project as a commit; a commit message explains in a short summary line, and optionally a body, what changed and why.
Picture it
The code shows what changed; only the message can say why. Write the summary as an instruction ('Limit motor PWM to 80 % to stop brown-outs'), keep it under about 72 characters, and make each commit one logical change.
Worked example
Rewrite 'stuff' as a useful commit message for a change that adds a 2 s timeout to the sensor-waiting loop.
- Say what changed
- Say why
- Keep the summary short and imperative
AnswerFor example: 'Add a timeout to the sensor wait loop', with the body 'Without it the robot froze when the cable was unplugged; the loop now gives up after the timeout and reports an error.'
Common misconceptions
- Misconception: Version control is not a backup of only the final version; its value is the history.
- Misconception: Committing secrets such as passwords to a repository exposes them even after deletion.