今天在更新git本地倉(cāng)庫(kù)時(shí)發(fā)生了奇怪的沖突,想說(shuō)一下這個(gè)問(wèn)題的解決辦法掺逼。
本地倉(cāng)庫(kù)工作目錄中并沒(méi)有未提交的修改吃媒,很干凈,這時(shí)我想更新到遠(yuǎn)程倉(cāng)庫(kù)最新的狀態(tài)吕喘,所以執(zhí)行了git pull命令赘那,結(jié)果發(fā)生了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_臨時(shí)文件裸機(jī)文檔程序眾包/100ASK_IMX6ULL裸機(jī)程序/001_led->05_100ASK_IMX6ULL裸機(jī)程序/10異常與中斷/008_exception in HEAD. Rename directory 05_臨時(shí)文件裸機(jī)文檔程序眾包/100ASK_IMX6ULL裸機(jī)程序/001_led->10裸機(jī)開發(fā)/01_100ASK_IMX6ULL裸機(jī)程序/4_led in fa84f29a7a0ef0d5637a1309d057cd1f9aa630da
Auto-merging 更新記錄.txt
CONFLICT (content): Merge conflict in 更新記錄.txt
CONFLICT (modify/delete): 嵌入式Linux應(yīng)用開發(fā)完全手冊(cè)第2版韋東山全系列視頻文檔全集.pdf deleted in fa84f29a7a0ef0d5637a1309d057cd1f9aa630da and modified in HEAD. Version HEAD of 嵌入式Linux應(yīng)用開發(fā)完全手冊(cè)第2版韋東山全系列視頻文檔全集.pdf left in tree.
CONFLICT (rename/delete):
......
'''
感覺(jué)很奇怪,后來(lái)想了想氯质,應(yīng)該是太久沒(méi)更新了募舟,有些目錄發(fā)生了變更,導(dǎo)致merge的時(shí)候沖突了闻察。具體原因就不深究了拱礁,下面說(shuō)一下解決方案:
- git fetch origin master
先把遠(yuǎn)程倉(cāng)庫(kù)最新?tīng)顟B(tài)拉到本地(以master為例); - git reset --hard origin/master
將本地倉(cāng)庫(kù)重置到遠(yuǎn)程倉(cāng)庫(kù)最新?tīng)顟B(tài)(本地將被覆蓋)辕漂。
以上~~~