我做了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 repo上(所以我现在有两个遥控器用于我的项目)。但是在我可以推送到nodester之前,我需要修复两个文件,这两个文件与我在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.发布于 2012-02-09 02:33:05
Git打开vim是因为您的环境变量EDITOR设置为vim,并且Git认为您需要为合并操作提供提交消息,因此它将打开一个编辑器供您输入一个。
可以通过将环境的EDITOR变量更改为您喜欢的变量,或者在git merge -y后提供-- message“this is my commit message”参数来修复此问题
发布于 2016-04-07 15:34:35
如果您想要的是执行合并并避免打开任何文本编辑器,则可以向merge命令添加--no-edit,这样它就不会打开提交消息的编辑器。
发布于 2020-06-16 13:36:45
如果您希望完全跳过文本编辑器,而使用默认的合并消息,只需在.bash_profile、.bashrc或.zshrc文件中添加以下行:
export GIT_MERGE_AUTOEDIT=nohttps://stackoverflow.com/questions/9199222
复制相似问题