r/programming • • Oct 08 '26

How big is a Git commit?

https://ratfactor.com/cards/git-commit-size
159 Upvotes

46 comments sorted by

View all comments

185

u/nmopqrs_io Oct 08 '26

This is why I always just amend my first commit and re-push it with force, saves on disk space.
If you’re not using force, are you really using git?

54

u/jaerie Oct 09 '26

I use --force-with-lease. No idea what it does but it feels safer

57

u/whitethunder9 Oct 09 '26

If there are changes that didn’t come from you on remote then force with lease won’t force push over them

4

u/Recol Oct 09 '26

So what you are saying remove the argument as my changes will always overrule my colleagues?

3

u/atheken Oct 10 '26

Alternatively, don’t share working branches with your coworkers. Seriously. Long-lived working branches are an org smell.

1

u/Recol Oct 10 '26

It was a joke. Regardless, coworkers committing back on pull requests aren't really a org smell.

1

u/atheken Oct 10 '26

With due respect, if it’s infrequent, incidental tweaks, I can agree that it’s not really an issue. If you have multiple people simultaneously modifying a “long lived” branch to deliver value, it’s an indicator that the code or work items are not properly factored. Incidental, sure, but if it’s the norm, it’s probably a problem.

2

u/Recol Oct 10 '26

Or engineers nit pick and it reduces review time if they commit those themselves. If they make actual logic changes then yes, I agree.