Search code examples
gitbashgithubterminal

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


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?)


Solution

  • You won't lose commits by closing the terminal.

    ctrl+c will exit the prompt >

    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.

    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.