2013-01-25 103 views
26

我已經和一個團隊合作了近一年了。使用github/git來拉取和推送更改總是很容易:E325:注意通過名稱「.git/.COMMIT_EDITMSG.swp」找到交換文件。

git pull 
git add . 
git commit -a -m "my work desc" 
git push 

直到最近,它一直運行良好。現在無論如何,如果別人有推,每當我試圖拉我得到這個消息:

E325: ATTENTION 
Found a swap file by the name ".git/.COMMIT_EDITMSG.swp" 
      owned by: X dated: Wed Jan 23 16:01:06 2013 
     file name: ~X/Sites/mysite/.git/COMMIT_EDITMSG 
      modified: no 
     user name: X host name: X-2.local 
     process ID: 77109 
While opening file ".git/COMMIT_EDITMSG" 
      dated: Thu Jan 24 16:22:48 2013 
     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/COMMIT_EDITMSG" 
    to recover the changes (see ":help recovery"). 
    If you did this already, delete the swap file ".git/.COMMIT_EDITMSG.swp" 
    to avoid this message. 

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

每次沒有失敗時會發生這種情況。我最終可以通過插入一條消息來解決這個問題,保存並重新發布,但這是一個痛苦。任何想法爲什麼這種情況繼續發生和可以做什麼?

感謝

+0

你是否做了所有沒有'm'國旗的提交? – alex

+0

我這樣做,那是不好的? – AnApprentice

+0

當你拉扯時,或者拉扯後提交時,你會得到這條消息嗎? –

回答

24

除非你需要的.git/.COMMIT_EDITMSG.swp用於其他目的,你可以使用:

git rm .git/.COMMIT_EDITMSG.swp 

從資源庫中刪除該文件。

+1

只需在PowerShell中按d即可刪除文件。這是由Vimdiff查看器的意外更改而產生的。 – TechieBrij

12

我有同樣的問題,由於某種原因,使用git rm沒有爲我工作。

爲了解決這個問題,我只是簡單地刪除了文件:$ rm .git/.COMMIT_EDITMSG.swp並解決了這個問題。

+1

我的情況完全一樣,這幫助我解決了問題!謝謝! –

0

你只需要提交更改,如果從另一個分支合併後,你這個交換錯誤信息。我添加了 - 綠色文件沒有提交。我犯了這些文件 - 然後完成。