How to push an empty git commit

Josh Sherman
1 min read
Command-line Interface Version Control

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!

Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

Related Articles