Found a swap file by the name “~/xdf/daxue-ui-tiku-manage/.git/.MERGE_MSG.swp“

git pull 出现如下报错:

Found a swap file by the name "~/xdf/daxue-ui-tiku-manage/.git/.MERGE_MSG.swp"
          owned by: yangshaotong   dated: 五  9 24 14:16:05 2021
         file name: ~yangshaotong/xdf/daxue-ui-tiku-manage/.git/MERGE_MSG
          modified: YES
         user name: yangshaotong   host name: yangshaotongdeMacBook-Pro.local
        process ID: 58264
While opening file "/Users/yangshaotong/xdf/daxue-ui-tiku-manage/.git/MERGE_MSG"
             dated: 五  9 24 17:34:35 2021
      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 /Users/yangshaotong/xdf/daxue-ui-tiku-manage/.git/MERGE_MSG"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/Users/yangshaotong/xdf/daxue-ui-tiku-manage/.git/.MERGE_MSG.
swp"
    to avoid this message.

Swap file "~/xdf/daxue-ui-tiku-manage/.git/.MERGE_MSG.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: 
Swap file "~/xdf/daxue-ui-tiku-manage/.git/.MERGE_MSG.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:

当前选择A或Q之后,不管是执行pull或者push都会报错,如下:请添加图片描述

解决方案:

第一步: 保证要提交的代码不丢

1、拷贝当前分支

git checkout -b 拷贝分支名

2、切换到其他分支准备删除当前分支

git checkout 其他分支(如:master)

3、删除刚才已被备份的分支

git branch -D 已被备份的分支

4、基于master或其他可靠的分支创建新分支

git checkout -b 新分支

5、把备份的分支合并到新分支(之前没有提交的代码就回来了)

git chirry-pick 备份分支名

第二步: 修复问题
删除错误提示中的文件即可

sudo rm -rf /Users/yangshaotong/xdf/daxue-ui-tiku-manage/.git/.MERGE_MSG.swp
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值