在Windows上从命令行添加换行符到git commit -m [英] Add line break to git commit -m from command line on Windows

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

问题描述

我的公司有一项政策,即对特定项目的所有签入必须遵循git提交的特定多行模板。我怎样才能最简单地创建一个单一的提交消息,在Windows中的命令行有多行?



这几乎完全是将换行符添加到git commit -m从命令行,除了这个问题特定于Windows / cmd.exe,而该问题与bash有关。

git commit -F< message_file> >之后,您可以不断编辑和重新使用该文件,或者创建一个模板文件并使用 git commit -t > 熟练的模板来填充。通过设置 commit.template 配置变量,第二个选项可以设置为永久的,所以您不需要使用 -t ...每次提交时>位。如果您的 git 参见 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屋!

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