我和团队一起工作了近一年了。使用github / git来拉动和推送更改总是很容易:
git pull
git add .
git commit -a -m "my work desc"
git push
直到最近,这一直很好。现在无论如何,如果有其他人推,每当我试图拉,我得到这个消息:
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:
每次失败都会发生这种情况。我最终可以通过插入消息,保存并重新发送来解决这个问题,但这很痛苦。知道为什么会一直这样,可以做些什么?
由于
答案 0 :(得分:34)
除非您出于其他目的需要 .git / .COMMIT_EDITMSG.swp ,否则您可以使用:
git rm .git/.COMMIT_EDITMSG.swp
从存储库中删除文件。
答案 1 :(得分:16)
我遇到了同样的问题,出于某种原因使用git rm
并不适合我。
要解决此问题,我只需删除文件:$ rm .git/.COMMIT_EDITMSG.swp
即可解决问题。
答案 2 :(得分:0)
如果在从另一个分支合并之后,您只需提交更改此交换错误消息。我添加了git - 未提交绿色文件。我提交了文件 - 然后完成了。
答案 3 :(得分:0)
我尝试删除该消息,但失败,并抱怨我没有此类文件。因此,我在进行-m
时添加了一个提交消息git commit -m
,警告不再显示。