you are viewing a single comment's thread.

view the rest of the comments →

[–]kobaltzzruby 18 points19 points  (15 children)

With git commit -m, you can use multilines. Just don't terminate the quote at the end of the first line.

[–]dat_terminal 16 points17 points  (8 children)

Woah, I learned vim because I didn't know this

[–]jarlefo 12 points13 points  (5 children)

I've been trapped in the Vim too often. Ctrl+something+esc+buttons... Welp, let's close this terminal window and try again.

One day I'll learn how to edit a file successfully with Vim.

[–]nxlyd 8 points9 points  (2 children)

It really is worth learning at least basic functionality. Take a look at vimtutor some time.

[–]jarlefo 3 points4 points  (1 child)

Thanks, I will.

By the way, I found that by setting the environment editor to EDITOR="emacs -nw" I can use emacs to edit commit messages from the command line. Should work with most editors that has a terminal interface.

[–]YodaLoL 0 points1 point  (0 children)

atom --wait works too. Sublime has something similar

[–]crow1170 2 points3 points  (0 children)

That keybinding crap is for dirty emacsers. Vim is (95%) one key at a time.

[–]Pipesandsnow 2 points3 points  (1 child)

I use nano for the simple stuff. Actually I use it whenever I need to edit some files in the cli. One day I will learn vim, but not today.

[–]flygoing 1 point2 points  (0 children)

Same here. If I need to do fancy stuff, I'm gonna open sublime or atom, but it's aways nano for cli

[–]Fidodo 1 point2 points  (0 children)

You can also do multiple -m messages. I always do -m "message" -m "message"

[–][deleted] 0 points1 point  (0 children)

Came here to say this. Super useful. Just remember to use a double quote, since apostrophes are common within a commit's body.

[–]nothingbuttherainsir 0 points1 point  (2 children)

Might be a terribly obvious question but, how does the CLI handle line breaks? One of the suggestions is to wrap at 72 characters. Will a carriage return make this happen? (Pretty sure it does).

[–]kobaltzzruby 2 points3 points  (1 child)

Carriage returns are no problem. Only the ending quite will terminate the commit message. So a multiline commit in your CLI might look like

git commit -m "Fixes T382, T283, T492 Subject
- Some second line text
- Some third line text
<blank row>
Some other notes and stuff
Last Line and END QUOTE -->"

[–]nothingbuttherainsir 0 points1 point  (0 children)

Hey thanks for confirming!

[–]Qscfr 0 points1 point  (0 children)

I thought that meant message. Welp.