How to push an empty commit in Git
Pushing an empty commit using Git is straightforward. Git provides an optional flag on the git commit
command: --allow-empty
.
Pushing without making changes
1git commit --allow-empty -m "empty commit"
1git push
The commit will be pushed without requiring changes.
Why is this useful?
This is useful for retrying a CI pipeline when an issue occurs with a GitHub webhook or CI service.