I have developed a habit of pushing to the origin after each commit. Most of my commits are rather trivial, in the sense that I commit after making small changes. Is it a good practice?
I am under the impression that pushing after each small commit increases the size of repository compared to pushing after making several commits. Is this understanding wrong?
As long as your commits reside only in your local repository you can fiddle with them (git commit --amend to fix last commit, or git rebase -i to reorder and tidy up your work). Pushing them right after commiting makes it rather hard to fix later.
I like to push my changes once a day, unless they are about to be deployed or tested by someone else. It gives me a margin to find out that I have commited something a bit too early.
It should not affect size of your repository in any way.
I have developed a habit of pushing to the origin after each commit. Most of my commits are rather trivial, in the sense that I commit after making small changes. Is it a good practice?
In my opinion, you should not push every commit to the origin. Instead, use interactive rebasing when you finish working with a feature to squash the smaller commits, and push the feature as one commit to the origin. But there's not definite answer for this - googling for "git workflow" will give you several options.
I am under the impression that pushing after each small commit increases the size of repository compared to pushing after making several commits. Is this understanding wrong?
Wrong. But if you rebase before pushing, then the squashed commits won't end up in the origin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With