Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Found a swap file by the name ".git/.MERGE_MSG.swp"

I tried to pull origin branschName

and got this strange error:

error: There was a problem with the editor 'vi'.
Not committing merge; use 'git commit' to complete the merge.


E325: ATTENTION
Found a swap file by the name ".git/.MERGE_MSG.swp"
          owned by: eladb   dated: Tue Aug 20 10:52:03 2013
         file name: ~eladb/MyWorkspace/Client/.git/MERGE_MSG
          modified: no
         user name: eladb   host name: Elads-MacBook-Pro-2.local
        process ID: 29959 (still running)
While opening file ".git/MERGE_MSG"
             dated: Tue Aug 20 10:53:11 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/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, (Q)uit, (A)bort:

how to fix this?

like image 915
Elad Benda Avatar asked Aug 20 '13 07:08

Elad Benda


People also ask

How do I delete a SWP file in Git?

You can just remove your file by the usual rm command without using git. Maybe check that you are in the right project, or add this folder to your project first (then remove the file).

How to recover deleted changes in merge_MSG?

If this is the case, use ":recover" or "vim -r /Users/username/Documents/Sites/recipegenerator/.git/MERGE_MSG" to recover the changes (see ":help recovery"). If you did this already, delete the swap file "/Users/username/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp" to avoid this message.

Why am I getting a merge error in Git?

This issue occurs when a commit or merge session is going on in one of the two instances of GIT. i.e. Git Bash & Visual Studio Git. Both instances try to edit the same file & we get this error message. Complete the commit or merge session in one of the two opened instances.

How do I recover changes to a swap file?

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

What is the difference between SWP file and swap file?

If this file already exists (e.g., when you are recovering from a crash) a warning is given and another extension is used, " .swo ", " .swn ", etc. An existing .swp file will never be overwritten. The swap file is deleted as soon as Vim stops editing the file.


1 Answers

It seems that a swap file created by vi has been somehow left undeleted.

Remove .git/.MERGE_MSG.swp and attempt the git merge again.

like image 166
devnull Avatar answered Sep 29 '22 12:09

devnull