Why you should always make SMALL Git Commits

Whether you are a beginner at Git version control or not, you should always make many small git commit rather than few big commits.

git commit -m 'Always make many small commits'

The reason is that amount of problems you can run into will multiply fast if you commit and push big chunks of files and data at once.

Small commits have two major benefits:

  • It helps to prevent fatal losses of code.
  • It makes it easier to read and follow your code changes.

Development mode and production mode are not identical environments. Just because you don’t get any bugs in local dev mode, it doesn’t mean you won’t get errors once you push your changes to production (online).

With big commits, it’s hard to quickly find the sinner, if one or two files out of 10, 20, 30+ files cause your server, client, or something else to malfunction.

By only pushing small changes at a time, you can quickly find the problematic file, revert your commit, fix the issue, and commit it again.


Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊

Kofi

Share & Discuss on