← all writing

Please, for the love of coding, don't commit on save

· 3 min read · Comments ↓

Commit on save is a bad idea and doesn't make sense. all arguments for it are invalid.

Listen to this post
0:00

A lot of popular influencers like levelsio love to promote the idea of “commit on save” and I think it’s a terrible idea.

First of all - why do it at all?

You’re spamming your git history, github servers, while making it much harder for yourself to build something people love.

Here’s all the arguments for it:

  • “because you don’t waste time writing commit messages”
  • “because you don’t have to think about what to commit”
  • “because [insert-popular-influencer] does it”
  • “it’s ok if you’re a solo developer”
  • “I don’t want to lose any of my code”

I’ll go through each of these arguments and explain why they’re invalid. and in the end, i’ll tell you what you should do instead.

”because you don’t waste time writing commit messages” & “because you don’t have to think about what to commit”

i hear this argument a lot from ‘hustle culture’ people. “you don’t have to waste time writing commit messages”. but you’re not wasting time. you’re documenting your code. you’re making it easier for other people to understand what you did. you’re making it easier for yourself to understand what you did. you’re making it easier to revert changes. you’re making it easier to find bugs. you’re making it easier to find regressions. you’re making it easier to find security issues. you’re making it easier to find performance issues. you’re making it easier to find anything that could be wrong with your code. so, writing commit messages makes your life easier and saves you time in the long run.

levelsio is a famous indie hacker. people listen to thier shit because they are really good at what they do and users love what they make. However, that does not mean any of that is a valid argument.

It’s the common logical fallacy of authority. “We don’t know as much as this guy does, hence he’s right. he has authority” - don’t you see the issue here?

it’s ok if you’re a solo dev

i’m a solo dev a lot of times. i get this - you don’t really need to maintain a clean commit history of your code. but do solo devs not have to find bugs and make their product better? do solo devs not have to work on multiple features sometimes? do solo devs not have to test things properly?

I don’t want to lose any of my code

common argument, but you don’t need to use git to store your code, for VS code users, it does it for you

vs code timeline

this timeline of changes has all the autosave changes ever, AND persists forever no matter what. you can close vs code, restart your computer, and it’ll still be there. you can even go back to a specific point in time and copy the code from there. YOU CAN EVEN SEE DIFF BETWEEN CHANGES.

so what should i do instead?

don’t save on commit, try naming your commits properly, and if you don’t want to do that, use the github copilot that automatically writes commit messages for you. if you really want to save every single change, use the timeline feature in vs code.

but i still want to commit on save

if you still want to commit on save, you can do that. but please, for the love of coding, don’t push it to github. it’s a waste of everyone’s resources, especially if you have github actions set up to build your code on every push.

conclusion

commit on save is a bad idea and doesn’t make sense. all arguments for it are invalid.

thx.