2012-02-08 108 views
13

我做了2個文件的合併,現在我試圖提交,但它打開VIM與以下數據,現在我完全失去了。 (我對VIM沒有經驗)Git合併後合併打開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的混帳回購協議(所以我現在有2個遙控器爲我的項目)。但在我推送到節點之前,我需要修復2個與節點上爲我生成的文件衝突的文件。我解決了與git merge -y的衝突,現在我想提交然後推送。

這是試圖推到nodester當我得到的錯誤:

Nodester! 
To [email protected]:/node/git/lolcoder/****-**************.git 
! [rejected]  master -> master (non-fast-forward) 
error: failed to push some refs to '[email protected]:/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. 
+0

這與node.js或nodster無關,請僅使用適當的標籤。在這種情況下GIT。 – thenetimp 2012-02-08 18:36:44

+0

我認爲這是git的「壞」特性。它只是減少了自動化。我必須包裝git命令以使其再次自動化。「 - message」save「適用於我。 – 2017-07-31 01:27:57

回答

13

Git是打開VIM,因爲你的環境變量EDITOR設置爲VIM,和Git認爲需要提供的提交信息合併操作,因此它打開一個編輯器讓你輸入一個。

你可以通過改變你的環境的EDITOR變量來改變你喜歡的東西,或者提供一個--message「這是我的提交信息」參數在git merge -y

+0

我做了'git commit - 'message'' – 2012-02-08 18:42:56

+0

什麼是EDITOR變量的默認值,這在我之前沒有發生過,我希望返回到默認行爲。 – Leito 2012-11-07 18:14:57

+0

默認值因系統而異。我不知道你以前是什麼。如果您沒有永久更改EDITOR變量(在您的.bashrc或類似文件中),那麼您可能只需打開一個新終端並恢復正常。 – mattbornski 2012-11-07 22:13:10

2

如果您想要執行合併並避免打開任何文本編輯器,則可以將--no-edit添加到合併命令中,以便它不會打開提交消息的編輯器。