How to Commit Multiline Messages in git commit

There are some easy ways to do this, it all depends on your personal preference

As developers, when using Git to commit code to a remote repository, we need to write information about this modification. On the command line, we use the git commit command, such as git commit -m which allows you to add a line of information. But sometimes a multi-line message with a title and a specific description may be more indicative of your intent, such as the following:

Commit Title: Briefly describe what I changed
Commit Description: Detailed instructions for changing it

So how to achieve this?

1. Use a text editor

Use git commit without the -m or git commit -v, which will take you to a text editor. So then you can add multiple lines of text using your favorite text editor.

2. Multiple -m options

Subscribe to keep reading

This content is free, but you must be subscribed to Web Developer to continue reading.

Already a subscriber?Sign In.Not now

Reply

or to participate.