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