为 git 输入提交消息后要做什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5048859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 10:08:20  来源:igfitidea点击:

What to do after typing in commit message for git?

gitcommitcommit-message

提问by Curyous

After I type in git commit -aa text editor pops up and I type in my comment. What buttons do I have to press after typing in the comment, to get it to move to the next stage of actually committing?

在我输入git commit -a文本编辑器后弹出并输入我的评论。输入评论后,我必须按哪些按钮才能使其进入实际提交的下一阶段?

I'm using mysysGit on Windows with the default setup.

我在 Windows 上使用默认设置的 mysysGit。

采纳答案by Max E.

Depends on the text editor you are using. Git chooses the editor specified in the environment variable "EDITOR." On Linux systems this is usually either Vi or Nano. Figure out which it is and then refer to the documentation for the appropriate editor.

取决于您使用的文本编辑器。Git 选择环境变量“EDITOR”中指定的编辑器。在 Linux 系统上,这通常是 Vi 或 Nano。找出它是什么,然后参考相应编辑器的文档。

回答by Nicholas Riley

Save the file and exit your editor.

保存文件并退出编辑器。

回答by zengr

try this:

尝试这个:

git add file-name  
git commit -m "here goes my awesome commit message"  
git push  

回答by Sailesh

A git commitalways requires a comment. You can give one like this git commit -m "my comment". If you do not provide a comment here, then a text editor pops up to force you to give a comment.

Agit commit总是需要注释。你可以给一个这样的 git commit -m "my comment"。如果您没有在此处提供评论,则会弹出一个文本编辑器来强制您发表评论。

Sometimes, you may actually need the editor to put in the commit message. This generally is required when you want to give a more detailed description of the commit along with the summary (write the summary followed by a blank line followed by the description).

有时,您可能实际上需要编辑器来放入提交消息。当您想提供更详细的提交描述和摘要时,这通常是必需的(写摘要,然后是空行,然后是描述)。

This is an extract from git help commit.

这是 git help commit 的摘录。

Though not required, it's a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. Tools that turn commits into email, for example, use the first line on the Subject: line and the rest of the commit in the body.

虽然不是必需的,但最好以一个简短的(少于 50 个字符)行总结更改开始提交消息,然后是一个空行,然后是更全面的描述。例如,将提交转换为电子邮件的工具使用 Subject: 行的第一行和正文中提交的其余部分。

EDIT:

编辑:

And after you type text in your text editor, just save and close it. If you try to do it without providing any comment, the commit will fail.

在文本编辑器中输入文本后,只需保存并关闭它。如果您尝试在不提供任何评论的情况下执行此操作,则提交将失败。