git 通过终端git合并

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35664237/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:49:53  来源:igfitidea点击:

git merge through terminal

gitterminalgit-merge

提问by Nouvel Travay

I am trying to do a git merge through the terminal. I was working on branch fix_stuffand I need to merge back into develop. So I do as follows

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

git checkout develop
git merge --no-ff fix_stuff

Now it takes me to seemingly a text editor -- still within the terminal -- that has the following message

现在它看起来像是一个文本编辑器——仍然在终端内——它有以下消息

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

Sure enough I press iand then entered my message. Now that I am done with the message, I don't know how to proceed. I tried esc xthen esc q. Nothing.

果然我按下i然后输入了我的消息。现在我完成了消息,我不知道如何继续。我esc x当时试过了esc q。没有。

I am using Android Studio terminal through Mac El Capitan

我正在通过 Mac El Capitan 使用 Android Studio 终端

回答by intboolstring

Because you pressed ito enter your text, I think that editor is vim. Assuming that you typed in your commit message ok, you have to do

因为您按下i了输入文本,所以我认为该编辑器是vim。假设您输入的提交消息没问题,您必须这样做

<esc> :w <enter>

to write to the file and

写入文件和

<esc> :q <enter>

to quit. Note: things in <>denote key presses.

退出。 注意: 中的东西<>表示按键。

回答by ORIOLmendivil

Press Esc, next type ":wq" and press Enter

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

回答by gzh

If you have set vim as your editor, vim is launched to request you to enter your commit message after git merge --no-ff.

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

After you entered your commit message, you need to save message and exit vim.

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

There are two ways to save and exit vim

vim有两种保存退出方式

1. Esc key to switch to command mode, then enter

1.Esc键切换到命令模式,然后回车

:w
:q

2. Ctrl+z twice.

2. Ctrl+z 两次。