r/git • u/TachikawaKan5241 • 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
View all comments
29
u/jorgb 1d ago
Everytime your code compiles, runs and has tests to ensure it is in working condition. Never commit broken code, only exception is in a branch for safe keeps (you can also use git stash for that) but never on your main branch.