Git commit conventions¶
This page sets the rules for commit messages in ConnectSoft repositories. It is written for engineers and AI agents that write commits.
The history of the default branch is the change log of every ConnectSoft package, because no repository keeps a separate release-notes file by default (see Versioning and release). Commit messages are therefore written for a reader who scans the history months later.
These rules follow existing practice: about two thirds of recent commit subjects in ConnectSoft repositories already start with an imperative verb. Conventional Commits prefixes (feat:, fix:) are not used.
Rules¶
CS-GIT-004: Write the subject as one imperative line¶
Severity: minor · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active
Why¶
A one-line imperative subject reads as "this commit will …" and fits the one-line views of Git and Azure DevOps. Past-tense or vague subjects ("fixes", "wip", "changes") say nothing when scanned later.
Do¶
- Start with an imperative verb in sentence case:
Add,Fix,Update,Remove,Rename. - Keep the subject to 72 characters or fewer.
- Say what changes, not which file:
Fix order date shown in UTC on the orders page.
Don't¶
- End the subject with a period.
- Use past tense (
Added,Fixed), a Conventional Commits prefix, or placeholders such aswip,fixorchanges.
Example¶
How to check¶
Every commit subject in the pull request starts with a capitalised imperative verb, after an optional AB#<id> reference (CS-GIT-005). It has at most 72 characters and no trailing period.
CS-GIT-005: Reference the work item when there is one¶
Severity: minor · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active
Why¶
Azure DevOps links a commit to its work item when the message contains AB#<id>. The link shows why a change was made long after the pull request is forgotten.
Do¶
- Put
AB#<id>at the start of the subject when the change belongs to a work item, followed by the imperative subject. - Use one reference per work item; add more when a commit really serves several work items.
Don't¶
- Invent a work item reference, or reuse one from an unrelated change.
Example¶
How to check¶
When the pull request is linked to a work item, its commits reference that work item with AB#<id>.
CS-GIT-006: Explain the reason in the body of a non-trivial commit¶
Severity: nit · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active
Why¶
The diff shows what changed. Only the message can say why, which alternative was rejected, or what the reader must not undo.
Do¶
- For a change whose reason is not obvious from the subject, leave a blank line after the subject and explain why in a few sentences.
- Name any behaviour that changes for callers, and any follow-up that is still needed.
Don't¶
- Repeat the diff line by line in the body.
- Put secrets, customer data or personal data in a commit message.
Example¶
Collect coverage with Coverlet only
Two collectors in one run produced two reports and the quality check
read the lower one. Disable the Microsoft collector in the runsettings.
How to check¶
For a commit that changes behaviour, configuration or a public API, the body explains why.