我正在使用git commit -m 'commit message'
进行git,但这只是简短描述。我如何使用git bash添加更详细的描述?
答案 0 :(得分:4)
这个怎么样?
git commit -F - <<EOF
summary
This is
a multi-line
commit message.
EOF
答案 1 :(得分:4)
您知道吗,您只需键入git commit
,它就会弹出一个编辑器
你在?
您可以使用某些配置控制它所使用的编辑器。默认情况下,Git
然后会查看$GIT_EDITOR
,然后是core.editor
配置变量
$VISUAL
,最后是$EDITOR
。你可以看一下
搜索顺序的git-var
手册页,
并且git-config
有一点点
core.editor
部分中的信息。
答案 2 :(得分:3)
您可以指定多个-m
选项:
git commit -m 'foo bar' -m 'baz qux'
git log
会显示多个段落:
commit ...
Author: ...
Date: ...
foo bar
baz qux
答案 3 :(得分:1)
您可以将长提交消息存储在文件中,并在命令中指定文件名而不是消息。 所以命令看起来像 -
git commit -F <path/to/file>
参考:https://www.kernel.org/pub/software/scm/git/docs/git-commit.html
希望这有帮助!
答案 4 :(得分:0)
来自man git commit
:
-m <msg>, --message=<msg>
Use the given <msg> as the commit message.
If multiple -m options are given, their values
are concatenated as separate paragraphs.
换句话说,这可行:
git commit -m "Subject" -m "paragraph 1" -m "paragraph 2"
答案 5 :(得分:0)
如果提交消息太长,则从文件中获取提交消息
-F“file”, - file =“file” 从给定文件中获取提交消息。 使用 - 阅读 来自标准输入的消息。