E325:注意找到了一个名为“.git/.COMMIT_EDITMSG.swp”的交换文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14513349/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 15:20:32  来源:igfitidea点击:

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

gitgithub

提问by AnApprentice

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:

我已经和一个团队一起工作了将近一年了。使用 github/git 来拉取和推送更改总是很容易的:

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

谢谢

采纳答案by Mark Leighton Fisher

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

除非您需要.git/.COMMIT_EDITMSG.swp用于其他目的,否则您可以使用:

git rm .git/.COMMIT_EDITMSG.swp

to remove the file from the repository.

从存储库中删除文件。

回答by rafaelbiten

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

我遇到了同样的问题,由于某种原因,使用git rm对我不起作用。

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

为了解决这个问题,我只是简单地删除了文件:$ rm .git/.COMMIT_EDITMSG.swp并解决了问题。

回答by Mark Antony

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.

如果在从另一个分支合并之后您交换了错误消息,您只需要提交更改。我 git 添加了 - 未提交绿色文件。我提交了文件 - 然后完成了。

回答by Aileen Pang

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

我尝试删除该消息,但失败并抱怨我没有这样的文件。所以,我-m在做git commit -m的时候添加了一个提交消息,警告不再显示。