Published on

How to do empty commit in git and why?

Authors

Introudction

Have you ever needed to trigger a CI build but couldn’t because manual re-trigger was not an option? If so, you might be tempted to make a meaningless change to your source file only to make a git commit just to re-trigger the CI pipeline.

What if I told you there was a better way to do it? 🧐

Empty git commit

Yes! You can make a git commit without making any changes to your source file(s) whatsoever. For example:

git commit --allow-empty -m "Trigger CI build"

empty git commit command


I hope you find this tip interesting and helpful. If you did, please give it a like and share it with someone who might benefit from it.

My name is Ashutosh, and I work as a software engineer. I love to share my learning with the community. You can connect with me on LinkedIn and follow me on Twitter.