在Windows上从命令行添加换行符到git commit -m [英] Add line break to git commit -m from command line on Windows
问题描述
我的公司有一项政策,即对特定项目的所有签入必须遵循git提交的特定多行模板。我怎样才能最简单地创建一个单一的提交消息,在Windows中的命令行有多行?
这几乎完全是将换行符添加到git commit -m从命令行,除了这个问题特定于Windows / cmd.exe,而该问题与bash有关。
git commit -t >
熟练的模板来填充。通过设置 commit.template
配置变量,第二个选项可以设置为永久的,所以您不需要使用 -t ...每次提交时
>位。如果您的 git $ c>参见 git commit
手册页( git help commit
$ c>安装正确,或在线搜索)以获取更多信息。
My company has a policy that all checkins to a particular project must follow a specific multi-line template for git commits. How can I most simply create a single commit message that has multiple lines from the command line in Windows?
This is almost exactly a duplicate of "Add line break to git commit -m from command line" except that this question is specific to Windows/cmd.exe, while that question is related to bash.
解决方案 Either create a file that contains your commit message in the right format and use git commit -F <message_file>
, after which you can continually edit and reuse that same file, or create a template file and use git commit -t <template_file>
to open your editor with the pre-cooked template to be filled in. The second option can be made permanent by setting the commit.template
configuration variable, so you don't need to use the -t ...
bit on every commit. See the git commit
manual page (git help commit
, if your git
is installed correctly, or search online) for more information.
这篇关于在Windows上从命令行添加换行符到git commit -m的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!