git commit - 混乱 [英] git commit -a confusion
问题描述
我正在使用 Git Bash 并试图弄清楚当我输入git commit -a"时发生了什么.
I am using Git Bash and am trying to figure out what is happening when I type 'git commit -a'.
看起来 VIM 可以打开以编辑我的提交消息,但是我该如何保存并实际完成此提交?我在编辑器中输入并按回车键,但它只会创建另一行.
Looks like VIM opens up to edit my commit message but how do I save and actually complete this commit? I type in the editor and hit enter but it just creates another line.
仅供参考:我在我的 mac 上使用 VM Fusion,所以我的一些键可能有点不同
FYI: I am using VM Fusion on my mac so some of my keys might be a little different
推荐答案
离开 VIM (命令模式 -> :wq
).
Just leave VIM (command mode -> :wq
).
-a
标志的作用类似于:
git add -u
git commit ...
-m
标志指定提交消息.该消息是强制性的,因此如果您不通过 (git commit -m "My message"
),将打开默认文本编辑器(您可以在 git 配置中更改它),您将拥有写一条提交信息,然后保存并退出编辑器.
-m
flag specifies commit message. That message is mandatory so if you don't pass that (git commit -m "My message"
) the default text editor will be opened (you can change it in git configuration) and you'll have to write a commit message, then save and quit the editor.
这篇关于git commit - 混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!