Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

E325: ATTENTION Found a swap file by the name ".git/.COMMIT_EDITMSG.swp"

Tags:

git

github

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

like image 835
AnApprentice Avatar asked Jan 25 '13 00:01

AnApprentice


3 Answers

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.

like image 86
Mark Leighton Fisher Avatar answered Nov 19 '22 03:11

Mark Leighton Fisher


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.

like image 21
rafaelbiten Avatar answered Nov 19 '22 02:11

rafaelbiten


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 .

like image 1
Aileen Pang Avatar answered Nov 19 '22 02:11

Aileen Pang