129

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?

0

3 Answers 3

147

From this accepted answer:

git commit -m "Title" -m "Description .........."
Sign up to request clarification or add additional context in comments.

Comments

143

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

3 Comments

Can i add both short description and extended description just like in the GitHub for Mac? I'm thinking of adding short description like 'bug fixes' and extended description on the bugs that was fixed..
@NickM, you should be able to run git config --global core.editor nano and it will configure git to use nano as your default editor. Replace "nano" with "emacs", "vim" or whatever your preference is.
@arnaslu Or export EDITOR=nano in your shell profile; this will affect a number of other command-line tools that use an external editor.
72

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

2 Comments

iirc you can do -m $'Basic msg\n\nExtended msg' if you are using bash. edit: this also may not be bash-specific
Best answer. Quick and easy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.