in Command-line Interface #Version Control

How to push an empty git commit

We've all been there. We need to trigger something from a commit to a git repository, and instead of triggering the build directly, we end up tweaking something in a file, committing it, and pushing it.

It's usually just adding a blank line (and subsequently removing it, depending on where in the dance we are) to the README.md file. Couple that with some toxic waste of a commit message like bump.

While this post won't help you get rid of the crappy commit message, it will save you a step by showing you how to perform a git commit without changing any files.

To make this magic happen, we need to include the aptly named --allow-empty argument when running git commit:

git commit --allow-empty -m "bump"

With our new, and very empty, commit created, simply git push as you normally would!