2012-11-26 294 views
8

我已經嘗試了一些建議,但似乎沒有刪除它。當我升級到Mountain Lion OS X時,就開始發生這種情況。任何時候我執行git pull時,它都會顯示這個令人討厭的問題,因爲它是標題爲MERGE_MSG的空編輯器。如何刪除git的MERGE_MSG?

如何防止在所有應用程序中彈出全球

+1

如果這種情況發生的頻率足以讓你感到厭煩,那麼這可能意味着你正在進行太多的合併,導致了一個醜陋的歷史。 – qqx

+1

如果你與其他開發者分享工作,該怎麼辦?這不是不可避免的嗎? – Trip

+0

請注意,此處的預期行爲是打開編輯器並讓用戶輸入消息。然而,這隻適用於nano等,並與崇高文本等失敗,因爲崇高的過程**立即退出**如果崇高已經打開(我總是保持打開) – xjcl

回答

13

您可以將--no-edit設置爲git pull,也可以將環境變量GIT_MERGE_AUTOEDIT設置爲no

git pull文檔:遠程分支當地的

--edit, --no-edit 
     Invoke an editor before committing successful mechanical merge to 
     further edit the auto-generated merge message, so that the user can 
     explain and justify the merge. The --no-edit option can be used to 
     accept the auto-generated message (this is generally discouraged). 
     The --edit option is still useful if you are giving a draft message 
     with the -m option from the command line and want to edit it in the 
     editor. 

     Older scripts may depend on the historical behaviour of not 
     allowing the user to edit the merge log message. They will see an 
     editor opened when they run git merge. To make it easier to adjust 
     such scripts to the updated behaviour, the environment variable 
     GIT_MERGE_AUTOEDIT can be set to no at the beginning of them. 
0

合併提供了更多的控制,然後拉。合併可以是「快進」(不需要合併消息),合併消息可以是有意義的。拉不會給你'快進'選項,並總是產生不鼓勵的默認合併消息。

0

A git pullgit fetch後面跟着git merge。 - 合併,如果它導致合併提交,請求該消息。

我會建議做一個git rebase而不是合併。它有助於保持歷史線性並避免額外的合併提交。 A git pull --rebase一次完成此操作(即,它是git fetch後跟git rebase)。