Skip to main content

How to create a Git commit without a message?

Published 1 min readMarkdown
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


About the author

No comments yet. Be the first to comment.

More from this blog