Writing multiline git commits without opening text editor.
Whenever you commit something in git, it opens Vim or nano or whatever editor you have configured. I really don't like opening Vim for writing the commit message and then saving & exiting it requires four more key strokes (Esc + w + q + Enter). It doesn't really sound like a lot, but when you write do a lot of small commits, it gets annoying pretty soon.
Initially I have restricted myself to use the `-m` option to single line commit messages.
Note the quotes. You can use either single or double quote, it doesn't matter. You just have to keep the quote un-closed as long as you want to write.
You can amend the commit like
On the other hand, you lose all the goodness of Vim like spell check, line wrap, highlighting long lines etc. So restrict it to really small commits.
Initially I have restricted myself to use the `-m` option to single line commit messages.
git commit -m 'Fixing an obsolete comment.'
Recently, I came to the realisation that you can write multiline commit messages just in terminal like this,
git commit -m 'Setting default_url_option for test env. > > * This helps the mailer to generate URL in the test environment'
Note the quotes. You can use either single or double quote, it doesn't matter. You just have to keep the quote un-closed as long as you want to write.
You can amend the commit like
git commit --amend -m 'Setting default_url_option for test env. > > * This helps the mailer to generate URL in the test environment. > * Without this setting you will not be able to test mailers.'
On the other hand, you lose all the goodness of Vim like spell check, line wrap, highlighting long lines etc. So restrict it to really small commits.