简体   繁体   中英

How to exit from commit edit message in git?

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 commit enter 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 提交编辑消息

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM