简体   繁体   中英

Git/GitHub commit with extended message/description

I recently use GitHub and downloaded GitHub for Mac.

I noticed you can add an 'extended description' using 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. 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.

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" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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