Nouvel Travay
Nouvel Travay

Reputation: 6472

git merge through terminal

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

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 i and then entered my message. Now that I am done with the message, I don't know how to proceed. I tried esc x then esc q. Nothing.

I am using Android Studio terminal through Mac El Capitan

Upvotes: 15

Views: 43954

Answers (3)

ORIOLmendivil
ORIOLmendivil

Reputation: 81

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

Upvotes: 8

intboolstring
intboolstring

Reputation: 7110

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

<esc> :w <enter>

to write to the file and

<esc> :q <enter>

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

Upvotes: 28

gzh
gzh

Reputation: 3616

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

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

There are two ways to save and exit vim

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

:w
:q

2. Ctrl+z twice.

Upvotes: 0

Related Questions