E325:注意找到一个名为".git/.COMMIT_EDITMSG.swp"的交换文件

AnA*_*ice 36 git github

我已经和团队合作了近一年了.使用github/git来拉动和推送更改总是很容易:

git pull
git add .
git commit -a -m "my work desc"
git push
Run Code Online (Sandbox Code Playgroud)

直到最近,这一直很好.现在无论如何,如果有人推,每当我试图拉,我得到这个消息:

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:
Run Code Online (Sandbox Code Playgroud)

每次失败都会发生这种情况.我最终可以通过插入消息,保存并重新发送来解决这个问题,但这很痛苦.知道为什么会一直这样,可以做些什么?

谢谢

Mar*_*her 34

除非您出于某种其他目的需要.git/.COMMIT_EDITMSG.swp,否则您可以使用:

git rm .git/.COMMIT_EDITMSG.swp
Run Code Online (Sandbox Code Playgroud)

从存储库中删除该文件.


raf*_*ten 19

我有同样的问题,由于某种原因使用git rm不适合我.

为了解决这个问题,我只是删除了文件:$ rm .git/.COMMIT_EDITMSG.swp这解决了问题.