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

3

u/realmauer01 1d ago edited 1d ago

Its hard to commit too often. Its easy to not commit often enough. But the details depend on the context, if you have a team and go with a merge strategy it changes a bit. Also if you create new branches you can always rebase squash / fixup your commits.

If you are in a state that doesnt compile you just need to name your commit accordingly.