Git Commit after merge opens 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 firstname.lastname@example.org:/node/git/lolcoder/****-**************.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'email@example.com:/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.
2 Solutions collect form web for “Git Commit after merge opens VIM”
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
If what you want is to perform the merge and avoid opening any text editor, you can add
--no-edit to your merge command so that it won’t open the editor for the commit message.