从命令行向“git commit -m"添加换行符 [英] Add line break to 'git commit -m' from the command line

查看:25
本文介绍了从命令行向“git commit -m"添加换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从命令行使用 Git,并试图在不进入 Vim 的情况下向提交消息添加换行符(使用 git commit -m "").

I am using Git from the command line and am trying to add a line break to the commit message (using git commit -m "") without going into Vim.

这可能吗?

推荐答案

当然,它是如何完成的取决于你的 shell.在 Bash 中,您可以在消息周围使用单引号,并且可以让引号保持打开状态,这将使 Bash 提示输入另一行,直到您关闭引号.像这样:

Certainly, how it's done depends on your shell. In Bash, you can use single quotes around the message and can just leave the quote open, which will make Bash prompt for another line, until you close the quote. Like this:

git commit -m 'Message

goes
here'

或者,您可以使用此处文档"(也称为 heredoc):

Alternatively, you can use a "here document" (also known as heredoc):

git commit -F- <<EOF
Message

goes
here
EOF

这篇关于从命令行向“git commit -m"添加换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆