DEV Community

Quoc-Hung Hoang
Quoc-Hung Hoang

Posted on

3 1

Commit message with title and body with one-liner git command

When you use git, one of the most frequent used command is

git commit -m "my commit message"
Enter fullscreen mode Exit fullscreen mode

But most of the time, you would give a more meaningful commit message. Meaningful I mean here is that the message should consist of subject line (a short description of your changes in code) and body (to give more detailed description of what you did)

Today I learn that git commit accept multiple message flag 😉
If you run this command

git commit -m "subject line" -m "commit description"
Enter fullscreen mode Exit fullscreen mode

It will result in this

Author: hunghoang-saritasa <hung.hoang@saritasa.com>
Date:   Thu Aug 11 16:29:07 2022 +0700

    Subject line

    Commit message
Enter fullscreen mode Exit fullscreen mode

This new finding helps me save time a lot. No need to open a vim editor when committing message with subject and body. And actually the git documentation do mention it.

Bonus: Another way to achieve this commit message structure is opening quotes then press enter and closing the commit with quotes again
Image description

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up