How to Push an Empty Commit in Git

Sarah Lean
1 min readJun 14, 2022

There are a lot of Git commands. I’m always discovering a new and useful one. This time I have found one that allows you to push an empty commit to a repository.

Why push an empty Git commit?

Git doesn’t allow you to push commits without making changes, and there are times when you don’t want to make changes but perhaps trigger a pipeline or job or build that is attached to a repository.

This is where pushing an empty commit can come in handy. If you can’t manually trigger your build or pipeline, staying in the command line prompt and pushing an empty commit can mean triggering the build or pipeline without making any changes.

How to push an empty commit

It is a fairly straight forward command, using the — allow-empty flag.

Very similar to pushing a commit when you’ve made changes to your code. But using this flag you can push a commit without making any changes. 😊

Originally published at https://www.techielass.com on June 14, 2022.

--

--

Sarah Lean

Community Speaker — Lifelong Learner — Founder of the Glasgow Azure User Group