合并后的Git Commit打开VIM

Sha*_*ean 15 git vim

我做了两个文件的合并,现在我试图提交,但它用以下数据打开VIM,现在我完全迷失了.(我对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
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

这是场景:

我在github上有一个node.js项目,现在我正在尝试将它推送到nodester的git repo(所以我现在有2个遥控器用于我的项目).但在我推送到nodester之前,我需要修复2个与在nodeter上生成的文件冲突的文件.我解决了冲突,git merge -y现在我想提交然后推.

这是我尝试推送到nodester时遇到的错误:

Nodester!
To git@nodester.com:/node/git/lolcoder/****-**************.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@nodester.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.
Run Code Online (Sandbox Code Playgroud)

mat*_*ski 14

由于您的环境变量EDITOR设置为vim,Git正在打开vim,Git认为您需要为合并操作提供提交消息,因此它打开一个编辑器供您键入.

您可以通过将环境的EDITOR变量更改为您喜欢的内容,或者通过提供--message"this is my commit message"参数来解决此问题. git merge -y


Ser*_*rco 5

如果您想要执行合并并避免打开任何文本编辑器,您可以添加--no-edit到您的合并命令,以便它不会打开提交消息的编辑器。