From 9c25a41e1d25a55b20f4af5f733b511047b4bbba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C5=82eczek?= Date: Wed, 22 Oct 2025 19:13:52 +0200 Subject: [PATCH] docs: Add commit structuring guidelines to CONTRIBUTING.md Added guidelines for structuring commits in pull requests to maintain a clean history and facilitate reviews. --- CONTRIBUTING.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69692094a7..12c538060c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,3 +53,15 @@ Check the [development docs](https://github.com/PostgREST/postgrest/blob/main/ni ### Running Tests For instructions on running tests, see the [development docs](https://github.com/PostgREST/postgrest/blob/main/nix/README.md#testing). + +### Structuring commits in pull requests + +To simplify review and to make it easy to split pull requests if deemed necessary, and to maintain clean and meaningful history of changes, follow these rules: + +* It must be possible to merge the PR branch into target using `git merge --ff-only`, ie. the source branch must be rebased on top of target. +* No merge commits in the source branch. +* All commits in the source branch must be self contained, meaning: it should be possible to treat each commit as a separate PR. +* Commits in the source branch must contain only related changes (related means the changes target a single problem/goal). For example, any refactorings should be isolated from the actual change implementation into separate commits. +* Tests, documentation, and changelog updates should be contained in the same commits as the actual code changes they relate to. An exception to this rule is when test or documentation changes are made in separate PR. +* Commit messages must be prefixed with one of the following prefixes: `fix: `, `test: `, `docs: `, `perf: `, `refactor: `. +* Commit messages should contain a longer description of the purpose of the changes contained in the commit and, for non-trivial changes, a description of the changes themselves.