Skip to main content

Command Palette

Search for a command to run...

How to create a Git commit without a message?

Updated
1 min read
How to create a Git commit without a message?

Solution

Here it is:

git commit --allow-empty-message -m ""

Explanation

To create a Git commit without a message, or with an empty message, you can use the --allow-empty-message flag with the git commit command.

git commit --allow-empty-message -m ""

Breaking it down:

  • git commit: This is the standard command for creating a new commit.

  • --allow-empty-message: This flag explicitly tells Git to allow a commit with an empty message.

  • -m "": This specifies an empty commit message. You must still include the -m flag, even if the message content is an empty string.


Done


More from this blog

Alexandre Calaça's Blog

265 posts

I'm a passionate software engineer with a deep love for turning complex problems into elegant solutions through code.