当我尝试将分支与远程分支合并时:
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:
如何处理这个问题?
发布于 2019-08-25 19:05:07
.MERGE_MSG.swp在你的git中是打开的,你只需要删除这个.swp文件。在我的例子中,我使用了下面的命令,它工作得很好。
rm .MERGE_MSG.swp
发布于 2016-12-02 13:47:44
当我试图将更改拉到一个分支中时,我也遇到了这个错误,这个分支不是从我试图从中拉出的上游分支创建的。
Eg -这将创建一个与上游的night-version
匹配的新分支
git checkout upstream/night-version -b testnightversion
这将在本地创建一个与上游的master
分支相匹配的分支testmaster
。
git checkout upstream/master -b testmaster
现在,如果我尝试将night-version
的更改拉到testmaster
分支中,则会导致此错误。
git pull upstream night-version //while I'm in `master` cloned branch
我设法通过导航到适当的分支并拉出更改来解决这个问题。
git checkout testnightversion
git pull upstream night-version // works fine.
发布于 2020-04-01 03:30:44
更多信息...有时,.swp文件可能由后台运行的虚拟机保存。当您尝试删除文件时,可能会看到权限被拒绝的消息。
https://stackoverflow.com/questions/13361729
复制相似问题