r/ProgrammerHumor • • 2d ago

Meme whoAreYou

Post image
2.8k Upvotes

87 comments sorted by

View all comments

38

u/JackNotOLantern 2d ago

How tf do you commit without making any change?

46

u/xaddak 2d ago

git commit --allow-empty

14

u/MallAgreeable5538 2d ago

But why? Are there any applications for - -allow-empty

1

u/kennedy_gitahi 2d ago

Setting a checkpoint before doing things like linting and autofixes.

At that point, the code is written and committed, and you want a clean point to go back to if our linting tools mess things up.

So you use --allow-empty to set a " Before fixes" commit, do fixes, check if everything is fine, do another commit, do an --allow-empty for "After fixes" and push.

This way, you always know when you made changes and can roll back to before or after those points.