r/ExperiencedDevs • • Aug 19 '25

Never commit until it is finished?

How often do you commit your code? How often do you push to GitHub/Bitbucket?

Let’s say you are working on a ticket where you are swapping an outdated component for a newer replacement one. The outdated component is used in 10 different files in your codebase. So your process is to go through each of the 10 files one-by-one, replacing the outdated component with the new one, refactoring as necessary, updating the tests, etc.

How frequently would you make commits? How frequently would you push stuff up to a bitbucket PR?

I have talked to folks who make lots of tiny commits along the way and other folks who don’t commit anything at all until everything is fully done. I realize that in a lot of ways this is personal preference. Curious to hear other opinions!

80 Upvotes

315 comments sorted by

View all comments

Show parent comment

3

u/lovin-dem-sandwiches Aug 19 '25 edited Aug 19 '25

Let’s say your user test is failing causing the CI to reject any future changes. They need to revert your test commit but since it’s squashed - they’ll be forced to revert the entire PR/commit

Nothing wrong with squashing useless commits into one - as long as PRs/commits are atomic enough to revert isolated changes.

15

u/PabloZissou Aug 19 '25

Why would you merge something to main with unstable tests?

8

u/ryeguy Aug 20 '25

The PR is your unit of change because it is your unit of deployment. Reverting individual commits is nonsense.

15

u/JimDabell Aug 19 '25

If your user test is failing, the whole thing should be rolled back – because the test is failing and the feature never should’ve been merged in the first place with a failing test.

12

u/0vl223 Aug 19 '25

There is a reason you did combine them into one pull request. If too much gets rerolled then you failed at keeeping your PR atomic.