commit type

fix commit template

A commit that corrects a defect: unintended behaviour, an error condition, or a regression that caused something to work incorrectly.

fix(scope): short imperative description of what is corrected - root cause of the bug (bullet 1) - what the incorrect behaviour was (bullet 2) - what the correct behaviour is now (bullet 3) Why the fix was necessary and any edge cases covered. Reference issue numbers in the footer if applicable (Fixes #123).
fix(auth): prevent session fixation by regenerating ID after login - destroy the pre-login session and issue a new session ID on successful auth - copy flash messages and CSRF token to the new session before destroying old - add regression test for the fixation scenario Session ID was not rotated on privilege escalation; an attacker who set a known session ID before login could take over the authenticated session.
fix(api): return 404 instead of 500 when requested resource is missing - catch RecordNotFound at controller level and map to 404 JSON response - add error body with machine-readable code field for client error handling - cover missing-resource path in API integration tests Unhandled RecordNotFound was propagating to the global 500 handler; clients had no way to distinguish a server error from a missing record.
fix(checkout): correct VAT rounding on fractional cent amounts - switch from Math.round to banker's rounding (round-half-to-even) for VAT - align calculation with EU VAT directive rounding rules - add test cases for 0.5-cent boundary amounts Accumulated rounding errors on large orders caused per-item VAT totals to diverge from the order-level VAT by up to 2 cents.
fix(notifications): de-duplicate email sends on job retry - add idempotency key derived from notification_id to outbox table - check for existing key before enqueuing send job - add unique index on (notification_id, channel) in migration Background job failures were retried without checking for prior sends, resulting in users receiving duplicate notifications on transient errors.

Use fix when correcting behaviour that was unintentionally broken: a bug, an edge case that causes errors, an incorrect calculation, a race condition, or a regression introduced by a previous change.

git-agent automatically analyzes your changes and infers the correct commit type.

brew install gitagenthq/tap/git-agent
Does fix trigger a patch version bump?
Yes. In semantic-release and release-please, a fix commit increments the PATCH version. If the fix also contains a BREAKING CHANGE footer, it increments MAJOR.
Should I use fix or refactor when I clean up code that also happens to fix a bug?
Use fix if the bug correction is the primary intent, and mention the cleanup in the body. Use refactor if the cleanup is the intent and document the incidental bug fix. Split them into two commits if both are substantial.
Is it correct to use fix for a security vulnerability patch?
Yes. Security patches that correct incorrect behaviour use fix. If the patch changes the public API in a breaking way, add a BREAKING CHANGE footer. You can also add a security advisory reference in the footer.