Programming 1 min read
How to Push Empty Git Commits
On this page
Why would you do it?
#Well, because you might need to trigger a build without making any changes to your project… and you might not have access to trigger the build manually.
How would you do it?
#It’s like pushing a normal commit, except you add the ---allow-empty flag.
So the entire command becomes:
git commit --allow-empty -m "Empty commit"
Git aliases
#You could shorten the command with git aliases, which allow you to create shortcuts for frequently used git commands.
To setup a new git alias:
git config --global alias.empty 'commit --allow-empty -m'
Now, instead of writing git commit --allow-empty -m "Empty commit" you could simply use git empty "Empty commit" and be done.
Will soon write a more in-depth article about git aliases.
Got it working, or hit a snag?
Share your setup, a fix or a question. Markdown and code blocks work.
Replying to
How comments and emails are handled: Privacy.