如何在 git 中执行多行提交消息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30423751/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to do a multiline commit message in git?
提问by Suman Lama
I have been doing a oneline commit message for some time now but it doesn't give the entire information on the commit.
我已经做了一段时间的单行提交消息,但它没有提供有关提交的全部信息。
git commit -m "message"
I once used git Gui tool and it had option to do multiline commit message. One in header and one in detail. How do we do it from the command line?
我曾经使用过 git Gui 工具,它可以选择执行多行提交消息。一个在标题中,一个在细节中。我们如何从命令行执行此操作?
And can some one explain any good practice to commit bug fix and new changes? I normally write "NEW:" or "FIX" at start of the commit message, i would like to know how you guys do this?
有人可以解释提交错误修复和新更改的任何良好做法吗?我通常在提交消息的开头写“新:”或“修复”,我想知道你们是怎么做到的?
回答by manojlds
You can do from the command line:
您可以从命令行执行以下操作:
git commit -m 'First line
Second line
Third line'
Alternatively, you can just let git trigger your editor by doing
或者,您可以让 git 通过执行以下操作来触发您的编辑器
git commit
回答by Sharvy Ahmed
Try this:
尝试这个:
git commit -m 'Multi
line
message'