2012-11-13 51 views
49

當我嘗試與遠程分支合併我分支交換文件:發現該名

git merge feature/remote_branch 

我得到這個消息:

E325: ATTENTION 
Found a swap file by the name ".git/.MERGE_MSG.swp" 
      owned by: xxxxxx dated: Mon Nov 12 23:17:40 2012 
     file name: ~xxxxxx/Desktop/My-ios-App/.git/MERGE_MSG 
      modified: YES 
     user name: xxxxxx host name: unknown-b8-8d-12-22-27-72.lan 
     process ID: 1639 
While opening file ".git/MERGE_MSG" 
      dated: Tue Nov 13 14:06:48 2012 
     NEWER than swap file! 

(1) Another program may be editing the same file. 
    If this is the case, be careful not to end up with two 
    different instances of the same file when making changes. 
    Quit, or continue with caution. 

(2) An edit session for this file crashed. 
    If this is the case, use ":recover" or "vim -r .git/MERGE_MSG" 
    to recover the changes (see ":help recovery"). 
    If you did this already, delete the swap file ".git/.MERGE_MSG.swp" 
    to avoid this message. 

Swap file ".git/.MERGE_MSG.swp" already exists! 
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: 

如何面對呢?

回答

52

看起來好像你有一個開放的git commitgit merge正在進行,並且編輯器仍在編輯提交消息。

兩個選擇:

  1. 找到了會議,並完成它(最好)。
  2. 刪除.swp文件(如果您確定另一個git會話已經消失)。
+5

如何找到.swp文件? – user3400881

+4

如何找到「會話」 - 這是什麼意思? – RUKAclMortality

0

我試圖把變化拉到一個不是從我試圖從上游分支創建的分支上時也出現了這個錯誤。

EG - 這將創建一個新的分支的上游

git checkout upstream/night-version -b testnightversion 

匹配night-version這在本地其中上游的master分支相匹配創建分支testmaster

git checkout upstream/master -b testmaster 

現在,如果我嘗試拉night-version將更改testmaster分支通向這個錯誤。

git pull upstream night-version //while I'm in `master` cloned branch 

我設法解決這個問題,通過導航到正確的分支並拉動變化。

git checkout testnightversion 
git pull upstream night-version // works fine.