DEV Community

Discussion on: Being intentional with commits

Collapse
 
qm3ster profile image
Mihail Malo

This is a good template for pull requests, but personally I don't recommend squishing pull requests into one commit.

Collapse
 
mindstormer619 profile image
Siddarth Iyer

May I know why you recommend not squashing commits for smaller PRs? I can see it shouldn't be done for larger PRs, but for simpler single-feature stuff (which you'd get anyway on frequent integration) setting a single commit would work well. You'd have a relatively cleaner git history and quick reverts if needed as well.

Thread Thread
 
qm3ster profile image
Mihail Malo

I find it better to have more commits for git-bisect.
Then it ends up being a specific incorrect refactor, which can be made an example of, by adding regression tests, mentioning it in team guidelines, adding lints etc.
When you want to revert the whole merge, you can still use a UI button or git revert -m 1 <merge-commit>.
As for full diffs, it's just as easy to diff two arbitrary points as the state before and after a single commit.
I just don't think it brings anything useful to the table.
Maybe it's appropriate to squash-merge to the release(not master) branch in a non-CD situation. Not sure.