How do you create an empty commit, and in what situations is that useful?

Last updated 6 July 2026

  • Create one with git commit --allow-empty -m "message", which bypasses the "nothing to commit" guard.

  • Useful to trigger CI/CD or a redeploy without code changes, mark a milestone, or open a pull request before any code exists.

  • https://www.git-tower.com/learn/git/faq/git-empty-commit
  • https://medium.com/@melissarspiegel/why-you-might-need-an-empty-git-commit-and-how-to-use-it-effectively-44059629ffeb
  • https://graphite.com/guides/empty-commit
  • https://gist.github.com/kjellskogsrud/d824c38f76e38010156d0bc80dbd3c62
  • https://coderwall.com/p/vkdekq/git-commit-allow-empty
  • https://needlify.com/empty-commits-in-git-what-they-are-and-how-to-use-them-effectively/
  • https://git-scm.com/docs/git-commit
  • https://git-scm.com/docs/git-commit/2.31.0
All Git interview questions