问题
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