Pregunta

I've been working with a team for almost a year now. It's always been easy to use github/git to pull and push changes using:

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

That has always worked fine until recently. Now no matter what, if someone else has pushed, whenever I try to pull I get this message:

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:

This happens every time w/o fail. I can eventually get past this by inserting a message, saving and recommitting but it's a pain. Any idea why this keeps happening and what can be done?

Thanks

¿Fue útil?

Solución

Unless you need .git/.COMMIT_EDITMSG.swp for some other purpose, you can use:

git rm .git/.COMMIT_EDITMSG.swp

to remove the file from the repository.

Otros consejos

I had the same problem and for some reason using git rm didn't work for me.

To solve the problem, I simply removed the file instead: $ rm .git/.COMMIT_EDITMSG.swp and that fixed the problem.

You simply need to commit the changes if after a merge from another branch you this swap error message. I git added - green files not committed. I committed the files - then done.

I tried deleting the message but it fails and complained that I do not have such file. So, I added a commit Message -m when doing git commit -m and the warning doesn't show any more .

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top