使用扩展消息/描述提交 Git/GitHub

我最近在 Mac 上使用并下载了 GitHub。

我注意到你可以在 Mac 上使用 GitHub 添加一个“扩展描述”。如何使用命令行添加扩展说明?

我可以向现有提交添加扩展描述吗?

28451 次浏览

Run git commit without a message and it'll open up your favorite* text editor to write a commit message. Details on the format of the message will appear in the sample.

First line is the short description. Leave a blank line after it. Everything else is the extended description.

*: for some values of "favorite"; results may vary

Actually, you can do this quite easily from the command line. The trick is to type your message (without a closing quote!) and then hit enter twice, and then type your extended message, close the quote and press enter.

It should look like:

$ git commit -m "Make everything work.
dquote>
dquote> Add magic code that fixes everything"

GitHub will correctly display the top line as your basic message and the bottom line as the extended message.

The following does NOT work. You end up with the literal "\n\n" in the commit message: $ git commit -m "Basic msg\n\nExtend msg, doesnt work".

From this accepted answer:

git commit -m "Title" -m "Description .........."