Git 上的扩展说明文本
Extended description text on Git
我想将消息和扩展描述文本提交到 Bitbucket 服务器。它存在于 Git-cola
软件中,我需要它的命令行。我正在使用 ubuntu,我需要 Extended description
的终端命令
git commit -am "My commit text" "My Extended description is this. Containing break lines in it."
git中没有“扩展描述”的概念。只有 提交消息 。发生的情况是提交消息可以有 单行 行或 多行 行。
外部工具或网站如git-cola或GitHub可以解释多行提交消息如:
- 第一行是简短描述
- 其他所有行都是扩展描述
对于一行消息,只定义了“简短描述”。
详情见GitHub commit with extended message。
正如 ckruczek 所建议的,您可以简单地 git commit
不带选项,然后将出现一个文本编辑器,只需将第一行写为简短描述,将其余行写为扩展描述。
如果您想从命令行执行此操作,可以使用此问题中提到的选项之一:Add line break to git commit -m from command line。
例如bash,你可以这样做:
git commit -m 'Message
goes
here'
或使用"here document"语法:
git commit -F- <<EOF
Message
goes
here
EOF
PS:例子直接取自Add line break to git commit -m from command line. Credits for Simon Ritcher and jpmc26中的答案。
作为第三种方式,您也可以使用临时文件:
echo $comment > message.tmp
echo $extended >> message.tmp
git commit -F message.tmp
rm message.tmp
还有另一个选项(也在this question answer中描述):您可以多次使用'-m
'选项指定多个消息:
git commit -m "Short description" -m "Extended description"
请注意,以这种方式指定,消息将被视为 段落,因此用空行分隔。
-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
时,您将获得一位编辑器。第一行是提交的主题,应该是现在连续时态的简短描述(少于 50 个字符)。然后是一个新行和一个 "extended description" ,其中应该包含包装到 72 列的更多详细信息。这可能是 git 可乐正在做的事情。 http://chris.beams.io/posts/git-commit/ 是一篇关于提交消息结构的好文章。
我想将消息和扩展描述文本提交到 Bitbucket 服务器。它存在于 Git-cola
软件中,我需要它的命令行。我正在使用 ubuntu,我需要 Extended description
git commit -am "My commit text" "My Extended description is this. Containing break lines in it."
git中没有“扩展描述”的概念。只有 提交消息 。发生的情况是提交消息可以有 单行 行或 多行 行。
外部工具或网站如git-cola或GitHub可以解释多行提交消息如:
- 第一行是简短描述
- 其他所有行都是扩展描述
对于一行消息,只定义了“简短描述”。
详情见GitHub commit with extended message。
正如 ckruczek 所建议的,您可以简单地 git commit
不带选项,然后将出现一个文本编辑器,只需将第一行写为简短描述,将其余行写为扩展描述。
如果您想从命令行执行此操作,可以使用此问题中提到的选项之一:Add line break to git commit -m from command line。
例如bash,你可以这样做:
git commit -m 'Message
goes
here'
或使用"here document"语法:
git commit -F- <<EOF
Message
goes
here
EOF
PS:例子直接取自Add line break to git commit -m from command line. Credits for Simon Ritcher and jpmc26中的答案。
作为第三种方式,您也可以使用临时文件:
echo $comment > message.tmp
echo $extended >> message.tmp
git commit -F message.tmp
rm message.tmp
还有另一个选项(也在this question answer中描述):您可以多次使用'-m
'选项指定多个消息:
git commit -m "Short description" -m "Extended description"
请注意,以这种方式指定,消息将被视为 段落,因此用空行分隔。
-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
时,您将获得一位编辑器。第一行是提交的主题,应该是现在连续时态的简短描述(少于 50 个字符)。然后是一个新行和一个 "extended description" ,其中应该包含包装到 72 列的更多详细信息。这可能是 git 可乐正在做的事情。 http://chris.beams.io/posts/git-commit/ 是一篇关于提交消息结构的好文章。