bash 如何退出我的 git commit 消息?我不在 VIM 中,我使用了“ commit -m”命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26228848/
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-18 11:29:19  来源:igfitidea点击:

How do I exit my git commit message? I'm NOT in the VIM, I used the " commit -m " command

gitbashgithubterminal

提问by Hunter

I was trying to commit a message and I accidentally made a typo:

我试图提交一条消息,但我不小心打错了字:

'git commit -m 'Deleted old Basic Syntax chapter README'

Now i'm stuck in the terminal, and all it shows is:

现在我被困在终端中,它显示的是:

> 
>
>
>
>asdfasdfad
>
>asd
>

How do I exit out of this, but still keep my commit message? I'm fine with having to re-commit, but I dont want to have to exit the terminal because I'm sitting on a few commits that I don't want to lose. (If i'll lose them at all?)

如何退出此操作,但仍保留我的提交消息?我可以重新提交,但我不想退出终端,因为我正在等待一些我不想丢失的提交。(如果我会失去它们?)

回答by Travis

You won't lose commits by closing the terminal.

关闭终端不会丢失提交。

ctrl+cwill exit the prompt >

ctrl+c将退出提示>

What happened was you opened up a string with the odd number of 'characters.
Bash expects more input for your string, and allows you to enter it after the >prompt.

发生的事情是您打开了一个包含奇数个'字符的字符串。
Bash 期望为您的字符串提供更多输入,并允许您在>提示后输入它。

Try typing 'and hit return, you will get the same thing. If you close the string by typing '`' again, you will be back to your normal bash prompt.

尝试输入'并点击return,你会得到同样的结果。如果您再次键入 '`' 关闭字符串,您将返回到正常的 bash 提示符。