How to enter a Git commit message in this editor?

心已入冬 提交于 2020-07-22 22:04:12

问题


I am trying to enter the Git commit message in the editor which looks like Vi, but none of commands like :wq, Esc etc. are working. Whenever I try to merge the master branch, this window pops up:

Merge branch 'master' into awesomebar

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.



--**-Mg: MERGE_MSG                        (fundamental)----All-------------------

And the cursor stays right at the beginning of the sentence Merge branch 'master' into awesomebar. Neither can I move the cursor, neither can I exit. Typing Esc gives the following commands:

Merge branch 'master' into awesomebar

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.



--**-Mg: MERGE_MSG                        (fundamental)----All-------------------
ESC-

And once I type something, I can't even delete it. How do I deal with this?


回答1:


It looks like to be Joe

From what I know to save and exit you must type ^kx (where ^ is equal to CTRL).

If you want to change default Git's editor, just update the EDITOR variable, in your ~/.bashrc by example:

export EDITOR="vim"



回答2:


The (fundamental) line is a hint that this is some kind of Emacs: Fundamental mode is one of the Major Modes of Emacs.

This is the documentation for the basic usage of Emacs:

  • Exiting Emacs
  • Basic editing commands


来源:https://stackoverflow.com/questions/50210686/how-to-enter-a-git-commit-message-in-this-editor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!