Found a swap file by the name

前端 未结 5 990
清酒与你
清酒与你 2020-12-13 12:10

When I try to merge my branch with a remote branch:

git merge feature/remote_branch

I got this message:

E325: ATTENTION
Fou         


        
相关标签:
5条回答
  • 2020-12-13 12:24

    Looks like you have an open git commit or git merge going on, and an editor is still open editing the commit message.

    Two choices:

    1. Find the session and finish it (preferable).
    2. Delete the .swp file (if you're sure the other git session has gone away).

    Clarification from comments:

    • The session is the editing session.
    • You can see what .swp is being used by entering the command :sw within the editing session, but generally it's a hidden file in the same directory as the file you are using, with a .swp file suffix (i.e. ~/myfile.txt would be ~/.myfile.txt.swp).
    0 讨论(0)
  • 2020-12-13 12:25

    .MERGE_MSG.swp is open in your git, you just need to delete this .swp file. In my case I used following command and it worked fine.

    rm .MERGE_MSG.swp
    
    0 讨论(0)
  • 2020-12-13 12:37

    More info... Some times .swp files might be holded by vm that was running in backgroung. You may see permission denied message when try to delete the files.

    0 讨论(0)
  • 2020-12-13 12:41

    I've also had this error when trying to pull the changes into a branch which is not created from the upstream branch from which I'm trying to pull.

    Eg - This creates a new branch matching night-version of upstream

    git checkout upstream/night-version -b testnightversion
    

    This creates a branch testmaster in local which matches the master branch of upstream.

    git checkout upstream/master -b testmaster 
    

    Now if I try to pull the changes of night-version into testmaster branch leads to this error.

    git pull upstream night-version //while I'm in `master` cloned branch
    

    I managed to solve this by navigating to proper branch and pull the changes.

    git checkout testnightversion
    git pull upstream night-version // works fine.
    
    0 讨论(0)
  • 2020-12-13 12:44

    Accepted answer fails to mention how to delete the .swp file.

    Hit "D" when the prompt comes up and it will remove it.

    In my case, after I hit D it left the latest saved version intact and deleted the .swp which got created because I exited VIM incorrectly

    0 讨论(0)
提交回复
热议问题