1

I usually commit by typing git commit -m "initial".

By default GNU nano editor is choice in git config.editor on ubuntu Gnome 19.04

And i accidentally commit my change typing git commitenter and GNU nano appear for editing commit message.
so How could i quit and return back to git terminal?

i went to look at this site : How do I exit from the text window in Git?
but didn't work for me. Git commit edit message

Prakash Karkee
  • 197
  • 1
  • 10

2 Answers2

4

I was unaware of the convention that ^ means to press ctrl.

So the solution is: Ctrl+X to abort, or Ctrl+z to stop.

tripleee
  • 175,061
  • 34
  • 275
  • 318
Prakash Karkee
  • 197
  • 1
  • 10
  • I don't use Nano (and would not recommend it to anyone) but I tried just now and mine doesn't seem to have ctrl-Z bound to anything. In many editors this suspends the editor and returns you to the shell, which means you can get back and continue editing where you suspended the editor with `fg`. https://wiki.archlinux.org/index.php/nano#Suspension shows that this can be enabled separately in Nano, too, but needs to be explicitly configured. – tripleee Nov 22 '19 at 08:39
  • 1
    https://www.nano-editor.org/dist/latest/cheatsheet.html has the entire keyboard shodtcut list. – tripleee Nov 22 '19 at 08:41
1

Note: nano is It's quite difficult to manage.It is better to get Git working with your code editor to make things simpler. Like for example if you use visual code you can add like this:

git config --global core.editor "code --wait"

or for atom:

git config --global core.editor "atom --wait" 

or for sublime:

git config --global core.editor "'C:/Program Files/Sublime Text 2/sublime_text.exe' -n -w"

Or you can search in Google how to associate you preferred your code editor with GIT. Like this, you will edit more easily and once you close the tab or sometimes close the editor. The commit will be automatically.

DINA TAKLIT
  • 7,074
  • 10
  • 69
  • 74