In the past, the OpenMRS advice has been that every PR should be a single commit. This is because commits are meant to be done at the level of ideas rather than the level of work. It may take several commits to get a feature working, but every feature should ultimately be represented as a single commit
We have enforced this primarily by putting a stern reminder in the pull request template that asks users to ensure that their PR consists of a single commit only.
However, the practice of ensuring a PR consists of a single commit makes things more difficult both for developers (who have to figure out how to squash commits and potentially deal with fallout from other commits) and reviewers (who then can only see a single snapshot of the code at a time and cannot see how the code has evolved with respect to various comments that have been made on it).
Squash! Best practice is to commit at the level of an idea (feature/fix). While you may have made 10+ commits while you worked, before you submit a pull request, make yourself look even smarter as if you knew how to do it all at once by “squashing” your changes into one that addresses the ticket.
However, at the end of the paragraph, it reads:
So, consider squashing when creating a pull request, don’t worry about squashing subsequent commits performed in response to the reviewer(s) comments. Ultimately, the person merging the pull request can perform a “squash on merge” via GitHub to make the final result appear a single, clean commit.
We would like to reiterate this to the community. While it is nice if the initial pull request consists of only a single commit, we would discourage you from doing any further squashing once code reviews have started. Ultimately, the person who commits the code will be able to squash things down to a single commit, once the change has been accepted.
In the coming days and weeks, the pull request templates for various repositories will be changed to no longer ask developers to certify that their PR consists of only a single commit. We still strongly encourage committers to squash everything in a PR into a single commit once it is ready to merge.