I'm commiting to git using git commit -m 'commit message', but this only has the short description. How would I add the more detailed description using git bash?
-
Why doesn't that work for longer messages?Thilo– Thilo2013-09-29 05:45:13 +00:00Commented Sep 29, 2013 at 5:45
-
I'm not saying it doesn't, but I didn't know you could have multiple optionsJimmt– Jimmt2013-09-29 05:45:34 +00:00Commented Sep 29, 2013 at 5:45
-
Possible duplicate of Add line break to git commit -m from command lineuser456814– user4568142014-03-29 12:53:28 +00:00Commented Mar 29, 2014 at 12:53
6 Answers
Did you know you can just type git commit and it will pop open an editor for
you to write your commit message in?
You can control which editor it is with some configuration. By default, Git
will look at $GIT_EDITOR, then the core.editor configuration variable, then
$VISUAL, and finally $EDITOR. You can look at the
git-var man page for the search order,
and the git-config has a little
information in the core.editor section as well.
Comments
You can specify multiple -m options:
git commit -m 'foo bar' -m 'baz qux'
git log will show multiple paragraphs:
commit ...
Author: ...
Date: ...
foo bar
baz qux
You can store the long commit message in a file and specify the filename instead of the message in your command. So the command will look like-
git commit -F <path/to/file>
Reference: https://www.kernel.org/pub/software/scm/git/docs/git-commit.html
Hope this helps!