今天在更新git本地仓库时发生了奇怪的冲突,想说一下这个问题的解决办法。
本地仓库工作目录中并没有未提交的修改,很干净,这时我想更新到远程仓库最新的状态,所以执行了git pull命令,结果发生了Conflict:
'''
$ git pull
remote: Enumerating objects: 391, done.
remote: Counting objects: 100% (391/391), done.
remote: Compressing objects: 100% (246/246), done.
remote: Total 387 (delta 170), reused 283 (delta 128)
Receiving objects: 100% (387/387), 267.25 MiB | 917.00 KiB/s, done.
Resolving deltas: 100% (170/170), completed with 3 local objects.
From https://e.coding.net/weidongshan/01_all_series_quickstart
2ea4337..fa84f29 master -> origin/master
- [new tag] V2.4 -> V2.4
- [new tag] V2.1 -> V2.1
- [new tag] V2.2 -> V2.2
- [new tag] V2.3 -> V2.3
Performing inexact rename detection: 100% (499086/499086), done.
CONFLICT (rename/rename): Rename directory 05_临时文件裸机文档程序众包/100ASK_IMX6ULL裸机程序/001_led->05_100ASK_IMX6ULL裸机程序/10异常与中断/008_exception in HEAD. Rename directory 05_临时文件裸机文档程序众包/100ASK_IMX6ULL裸机程序/001_led->10裸机开发/01_100ASK_IMX6ULL裸机程序/4_led in fa84f29a7a0ef0d5637a1309d057cd1f9aa630da
Auto-merging 更新记录.txt
CONFLICT (content): Merge conflict in 更新记录.txt
CONFLICT (modify/delete): 嵌入式Linux应用开发完全手册第2版韦东山全系列视频文档全集.pdf deleted in fa84f29a7a0ef0d5637a1309d057cd1f9aa630da and modified in HEAD. Version HEAD of 嵌入式Linux应用开发完全手册第2版韦东山全系列视频文档全集.pdf left in tree.
CONFLICT (rename/delete):
......
'''
感觉很奇怪,后来想了想,应该是太久没更新了,有些目录发生了变更,导致merge的时候冲突了。具体原因就不深究了,下面说一下解决方案:
- git fetch origin master
先把远程仓库最新状态拉到本地(以master为例); - git reset --hard origin/master
将本地仓库重置到远程仓库最新状态(本地将被覆盖)。
以上~~~
网友评论