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

5

u/TachikawaKan5241 22h ago

I had no idea about that flag for commit thanks! that'll be very useful I used to make whole new commits because I noticed a typo in my readme or forgot to make a .gitignore

1

u/devignswag 13h ago

You can also squash commits afterwards. Even better if you make commits to a feature branch, then squash merge into main when the feature is done.