我如何完成git提交?

Sim*_*Suh 2 git terminal cmd commit

我输入'git -commit'并在我的终端上获得以下内容

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
#
# Initial commit
#
# Changes to be committed:
#       new file:   index.html
#       new file:   index3.html
#
# Changes not staged for commit:
#       modified:   index.html
#
# Untracked files:
#       index2.html
#
Run Code Online (Sandbox Code Playgroud)

现在我被困在这个屏幕上,我不知道如何完成提交并返回到终端的目录区域以继续cmd中的其他任务.救命!

Ris*_*shi 7

这与 git 无关,而是与配置使用的文本编辑器有关。在 vim 中,您可以press i开始输入文本并通过按下esc and :wq将提交您输入的消息来保存。

在上述状态下,要退出而不提交,您可以:q代替上面提到的 :wq 。


vcs*_*nes 6

这是一个文本编辑器,可能是vi或vim.

您可以i按键进入插入模式并escape在完成后输入提交消息,然后ZZ(两次,大写)退出.

或者,您可以使用该-m选项将提交消息放在命令行中.

文本编辑器有一些不错的福利,一样能轻松进入新的生产线,等等.如果六是对你不好,你可以用git config --global core.editor <editorname>你的编辑器更改为更具自己的喜好.