Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Commit after merge opens VIM

Tags:

git

vim

I did a merge of 2 files and now Im trying to commit but it opens VIM with the following data and now I'm completely lost. (I have no experience with VIM)

Merge branch 'master' of nodester.com:/node/git/lolcoder/****-******

Conflicts:
        .gitignore
        server.js
#
# It looks like you may be committing a merge.
# If this is not correct, please remove the file
#       .git/MERGE_HEAD
# and try again.


# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#   
#       .project
~                                                                               
~                                                                               
~                                                                               
".git/COMMIT_EDITMSG" 19L, 521C                               1,1           All

What do I do from here?

Here is the scenario:

I had a node.js project on github, now I'm trying to push this to nodester's git repo (so I now have 2 remotes for my project). But before I can push to nodester, I needed to fix 2 files that conflicted with the ones generated on nodester for me. I solved the conflicts with git merge -y and now I want to commit then push.

This is the error I get when trying to push to nodester:

Nodester!
To [email protected]:/node/git/lolcoder/****-**************.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:/node/git/lolcoder/****-************.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
like image 330
Shawn Mclean Avatar asked Feb 08 '12 18:02

Shawn Mclean


People also ask

Do I need to commit after merge?

yes ..you need to commit MERGE STATEMENT.

How do I leave a merge commit message?

Type some message. Ctrl C O. Type the file name (such as "Merge_feature01") and press Enter. Ctrl X to exit.


1 Answers

Git is opening vim because your environment variable EDITOR is set to vim, and Git believes you need to provide a commit message for the merge operation, therefore it is opening an editor for you to type one in.

You can fix this by changing your environment's EDITOR variable to something you prefer, or by providing a --message "this is my commit message" argument after git merge -y

like image 144
mattbornski Avatar answered Sep 21 '22 14:09

mattbornski