r/git • • 1d ago

How often should I commit my changes?

I am fairly new to programming and git and I was just wondering how often I should commit my changes both locally and to Github? I feel like I'm doing it to often

9 Upvotes

79 comments sorted by

View all comments

Show parent comment

2

u/eliquy 1d ago

Doesn't even need to compile. I'd rather have a junior push a broken branch that can be cleaned up later than have them hold uncommitted files for a week only on their machine because they're too afraid to break something

1

u/burlingk 23h ago

Yeah. If they are nervous, that's what branches are for. :)

1

u/kpg_on_ao3 19h ago

Impossible for them to break anything if they're not allowed to push to main!

It should be a PR, and then someone higher up the food chain inspects PRs. Have very few people with permissions to merge a PR into main.

You should have workflows enabled that run tests on every PR, and merge/rebase+FF only if all tests pass.

Basic stuff.