当我尝试将我的分支与远程分支合并时:

git merge feature/remote_branch

我收到此消息:
E325: ATTENTION
Found a swap file by the name ".git/.MERGE_MSG.swp"
          owned by: xxxxxx   dated: Mon Nov 12 23:17:40 2012
         file name: ~xxxxxx/Desktop/My-ios-App/.git/MERGE_MSG
          modified: YES
         user name: xxxxxx   host name: unknown-b8-8d-12-22-27-72.lan
        process ID: 1639
While opening file ".git/MERGE_MSG"
             dated: Tue Nov 13 14:06:48 2012
      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, (D)elete it, (Q)uit, (A)bort:

怎么处理呢?

最佳答案

看起来您正在打开git commitgit merge,并且编辑器仍在打开状态,以编辑提交消息。

两种选择:

  • 查找 session 并完成它(最好)。
  • 删除.swp文件(如果您确定其他git session 已消失)。

  • 从评论中澄清:
  • 该 session 是编辑 session 。
  • 您可以通过在编辑 session 中输入.swp命令来查看正在使用什么:sw,但通常它是与所使用文件位于同一目录中的隐藏文件,后缀为.swp文件(即~/myfile.txt将为~/.myfile.txt.swp)。
  • 08-27 22:41
    查看更多