简体   繁体   English

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

[英]Git/GitHub commit with extended message/description

I recently use GitHub and downloaded GitHub for Mac. 我最近使用GitHub并下载了GitHub for Mac。

I noticed you can add an 'extended description' using GitHub for Mac. 我注意到你可以使用GitHub for Mac添加“扩展描述”。 How do I add an extended description using the command line? 如何使用命令行添加扩展描述?

Can I add an extended description to an existing commit? 我可以在现有提交中添加扩展描述吗?

Run git commit without a message and it'll open up your favorite* text editor to write a commit message. 在没有消息的情况下运行git commit ,它将打开你最喜欢的*文本编辑器来编写提交消息。 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 结果可能有所不同

从这个接受的答案

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

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. 诀窍是键入您的消息(没有结束报价!),然后按两次输入,然后键入您的扩展消息,关闭报价并按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. GitHub将正确显示顶行作为基本消息,底行显示为扩展消息。

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" . 您最终会在提交消息中使用文字“\\ n \\ n”: $ git commit -m "Basic msg\\n\\nExtend msg, doesnt work"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM