Git Commit after merge 打开VIM

标签 git vim

我 merge 了 2 个文件,现在我试图提交,但它打开了带有以下数据的 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

我可以从这里做什么?

场景如下:

我在 github 上有一个 node.js 项目,现在我正试图将其推送到 nodester 的 git 存储库(所以我的项目现在有 2 个 Remote )。但在我推送到 nodester 之前,我需要修复 2 个与 nodester 上为我生成的文件冲突的文件。我用 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.

最佳答案

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

您可以通过将环境的 EDITOR 变量更改为您喜欢的变量来解决此问题,或者通过在 git merge -y

之后提供 --message "this is my commit message"参数来解决此问题

关于Git Commit after merge 打开VIM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9199222/

相关文章:

windows - 安装 fugitive.vim 插件后,Vim 在 Cygwin 下启动非常慢

git 格式补丁输出文件没有提交消息

git - 有人向我的 Github 帐户添加了 SSH key

git - 如何永久防止文件的特定部分在 git 中提交?

.net - 我应该如何使用 Git 在多台计算机上的 SharpDevelop 项目中使用 SQL Server Compact Edition?

vim - 如何在 Vim 中高效地跨多个文件执行替换命令?

vim:转义字符串以进行替换(vimscript)

linux - 哪个版本的linux内核开始支持sd/sdio version 3.00?

Vim Python 模式折叠

vim - 'gq' 命令将注释行与非注释行合并