By default, Git ignores lines starting with #. If your commit message needs to contain a hashtag (e.g., #coding), this causes issues. You can change the comment character in your global config:

git config --global core.commentChar ";"

Now Git will ignore lines starting with ; and leave your # lines alone in the final commit.

Your editor has special support for COMMIT_EDITMSG:

You can configure a global COMMIT_EDITMSG template that appears for every repository you work on.

git config --global commit.template ~/.gitmessage.txt

Create ~/.gitmessage.txt:

# <type>(<scope>): <subject> (max 50 chars)
# |<----  using Conventional Commits  ---->|
#
# <body> Explain *what* and *why*, not *how*. (72 chars max)
#
# <footer> Any closing notes or breaking changes.
#
# --- Commits will be signed off with your user.email ---

Now, every time you run git commit, your editor opens with this custom template inside COMMIT-EDITMSG. It acts as a checklist, dramatically improving consistency across teams.

You can use a pre-commit or prepare-commit-msg hook to edit COMMIT_EDITMSG automatically (e.g., add a ticket number, strip trailing whitespace, enforce subject line length).

When you decide to edit a commit message, Git provides a file named COMMIT-EDITMSG for you to edit. This file contains the current commit message that you can modify. The process usually involves:

Clear and concise commit messages are essential for several reasons:

Commit-editmsg Page

By default, Git ignores lines starting with #. If your commit message needs to contain a hashtag (e.g., #coding), this causes issues. You can change the comment character in your global config:

git config --global core.commentChar ";"

Now Git will ignore lines starting with ; and leave your # lines alone in the final commit.

Your editor has special support for COMMIT_EDITMSG: COMMIT-EDITMSG

You can configure a global COMMIT_EDITMSG template that appears for every repository you work on.

git config --global commit.template ~/.gitmessage.txt

Create ~/.gitmessage.txt:

# <type>(<scope>): <subject> (max 50 chars)
# |<----  using Conventional Commits  ---->|
#
# <body> Explain *what* and *why*, not *how*. (72 chars max)
#
# <footer> Any closing notes or breaking changes.
#
# --- Commits will be signed off with your user.email ---

Now, every time you run git commit, your editor opens with this custom template inside COMMIT-EDITMSG. It acts as a checklist, dramatically improving consistency across teams.

You can use a pre-commit or prepare-commit-msg hook to edit COMMIT_EDITMSG automatically (e.g., add a ticket number, strip trailing whitespace, enforce subject line length). By default, Git ignores lines starting with #

When you decide to edit a commit message, Git provides a file named COMMIT-EDITMSG for you to edit. This file contains the current commit message that you can modify. The process usually involves:

Clear and concise commit messages are essential for several reasons: Now Git will ignore lines starting with ;