Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 550
Nouvel Travay Avatar asked Feb 27 '16 00:02

Nouvel Travay


People also ask

How do I merge in terminal?

To do a merge (locally), git checkout the branch you want to merge INTO. Then type git merge <branch> where <branch> is the branch you want to merge FROM.

What is git merge command?

The git merge command lets you take the independent lines of development created by git branch and integrate them into a single branch. Note that all of the commands presented below merge into the current branch.

How do I merge a branch to the main in terminal?

First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch. Note: git merge merges the specified branch into the currently active branch. So we need to be on the branch that we are merging into.


1 Answers

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.

like image 186
intboolstring Avatar answered Sep 17 '22 18:09

intboolstring