r/git • • 2d 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

12 Upvotes

86 comments sorted by

View all comments

Show parent comment

9

u/Soggy_Writing_3912 advanced 2d ago

that being said, i would still strongly suggest a commit at the outermost of 4 hrs of work. in other words, if you have been at it for 4 hrs, and still don't have some meaningful state (by developers' definition, not business definition), then something else is wrong.

1

u/shozzlez 2d ago

Even if you don’t push to a remote branch ?

4

u/Soggy_Writing_3912 advanced 2d ago

treat the remote as a safety net in case the laptop gets corrupted, fluid spillage, theft, etc. In that case, how often would you push to remote so that you at least have a backup copy?