git 通过终端合并

git merge through terminal

我正在尝试通过终端进行 git 合并。我在分支 fix_stuff 上工作,我需要合并回 develop。所以我做如下

git checkout develop
git merge --no-ff fix_stuff

现在将我带到看似文本编辑器——仍在终端内——它有以下消息

# 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.

果然我按了i然后输入了我的信息。现在我已经完成了消息,我不知道如何继续。我尝试了 esc x 然后 esc q。没有。

我正在通过 Mac El Capitan

使用 Android Studio 终端

因为你按了i输入你的文字,我认为编辑器是vim。假设您输入了提交消息 ok,您必须执行

<esc> :w <enter>

写入文件和

<esc> :q <enter>

退出。 注意:<> 中的内容表示按键。

如果您已将 vim 设置为您的编辑器,vim 将启动以要求您在 git merge --no-ff 之后输入您的提交消息.

输入提交消息后,您需要保存消息并退出 vim。

保存退出有两种方式vim

1。 Esc键切换到命令模式,然后输入

:w
:q

2。 Ctrl+z 两次。

Esc,然后输入“:wq”并按Enter