git整理紛亂的歷史合並記錄


https://github.com/Epix37/Hearthstone-Deck-Tracker

以上面版本庫的master分支為例

父節點1

SHA-1: a21142968282ae49720cf30a0f18290b2ce74b3a

* remove hotkey from config if action could not be found, fix hotkey menu item name

父節點2

SHA-1: 86a824e8f46005db91f334dfc57b6bb58b85ceed

* fix effigy logic

 

合並后的節點

SHA-1: abc0e44f72a4f73523a202c9ee77c8622c1e9fbc

* Merge branch 'master' into joshtab-feature-SecretDeduction

Conflicts:
Hearthstone Deck Tracker/GameEventHandler.cs
Hearthstone Deck Tracker/Hearthstone/GameV2.cs

 

 

======新的版本庫,自己進行整理的=====

在進行代碼整理的時候,遇到了沖突

現在chucklu_master分支指向這個commit

SHA-1: 88fa1ee9263402626d85b5a4362e1b620935953f

* remove hotkey from config if action could not be found, fix hotkey menu item name

 

temp1分支指向這個commit

SHA-1: 86a824e8f46005db91f334dfc57b6bb58b85ceed

* fix effigy logic

 

現在執行,rebase操作。

首先切換分支到temp1

然后執行git rebase chucklu_master

$ git rebase chucklu_master
First, rewinding head to replay your work on top of it...
Applying: proof of concept: secret deduction via game rules
Applying: add hooks: spell cast, minion play, minion death
Using index info to reconstruct a base tree...
M Hearthstone Deck Tracker/GameEventHandler.cs
M Hearthstone Deck Tracker/IGameHandler.cs
M Hearthstone Deck Tracker/LogReader/Handlers/PowerGameStateHandler.cs
M Hearthstone Deck Tracker/LogReader/Handlers/TagChangeHandler.cs
<stdin>:110: trailing whitespace.
if (actionEntity.HasTag(GAME_TAG.CONTROLLER) &&
warning: 1 line adds whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging Hearthstone Deck Tracker/LogReader/Handlers/TagChangeHandler.cs
Auto-merging Hearthstone Deck Tracker/LogReader/Handlers/PowerGameStateHandler.c
s
Auto-merging Hearthstone Deck Tracker/IGameHandler.cs
Auto-merging Hearthstone Deck Tracker/GameEventHandler.cs
Applying: add remaining paladin secret tracking
Applying: remove click-to-gray, respect setting
Applying: changed GameEventHandler.HandlePlayerAttack to consider attacker and d
efender,
Using index info to reconstruct a base tree...
M HDTTests/HDTTests.csproj
M Hearthstone Deck Tracker/GameEventHandler.cs
M Hearthstone Deck Tracker/IGameHandler.cs
M Hearthstone Deck Tracker/LogReader/Handlers/TagChangeHandler.cs
<stdin>:301: trailing whitespace.

warning: 1 line adds whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging Hearthstone Deck Tracker/LogReader/Handlers/TagChangeHandler.cs
Auto-merging Hearthstone Deck Tracker/IGameHandler.cs
Auto-merging Hearthstone Deck Tracker/GameEventHandler.cs
CONFLICT (content): Merge conflict in Hearthstone Deck Tracker/GameEventHandler.
cs
Auto-merging HDTTests/HDTTests.csproj
Failed to merge in the changes.
Patch failed at 0005 changed GameEventHandler.HandlePlayerAttack to consider att
acker and defender,
The copy of the patch that failed is found in:
d:/SourceCode/GitHub/Hearthstone-Deck-Tracker/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

 

遇到沖突后,rebase暫停,CONFLICT (content): Merge conflict in Hearthstone Deck Tracker/GameEventHandler.cs

找到原始的版本庫的合並節點SHA-1: abc0e44f72a4f73523a202c9ee77c8622c1e9fbc

 

雙擊GameEventHandler.cs文件

 

 

所以,可以換種處理方式,前面沖突的話,全部用temp1本身的的


Administrator@LUJUNTAO /d/SourceCode/GitHub/Hearthstone-Deck-Tracker/Hearthstone
Deck Tracker (temp1|REBASE 5/16)
$ git rebase --continue
Applying: changed GameEventHandler.HandlePlayerAttack to consider attacker and d
efender,
Applying: SecretTests: added more SingleSecret tests, simplified secret verifica
tion
Applying: SecretTests: fix minion CARDTYPE
Applying: refactor HandlePlayerAttack, fix misdirection
Using index info to reconstruct a base tree...
M Hearthstone Deck Tracker/GameEventHandler.cs
M Hearthstone Deck Tracker/Hearthstone/GameV2.cs
Falling back to patching base and 3-way merge...
Auto-merging Hearthstone Deck Tracker/Hearthstone/GameV2.cs
Auto-merging Hearthstone Deck Tracker/GameEventHandler.cs
CONFLICT (content): Merge conflict in Hearthstone Deck Tracker/GameEventHandler.
cs
Failed to merge in the changes.
Patch failed at 0008 refactor HandlePlayerAttack, fix misdirection
The copy of the patch that failed is found in:
d:/SourceCode/GitHub/Hearthstone-Deck-Tracker/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

 

 

 

 

這樣處理完之后,temp1拼接在了chucklu_master分支后面,此時切換到chucklu_master分支

合並的時候,不會產生沖突

所以在合並的時候,需要選擇不提交 no commit。

然后再去手動將本應該沖突的文件修改為之前的合並結果中的文件,進行提交

把合並結果abc0e44f72a4f73523a202c9ee77c8622c1e9fbc中的文件內容全部復制出來,作為沖突合並的結果。完全復制到沖突的那個文件中替換掉。

最后一次才用最終的合並結果

 

 

 

補充說明,重新嘗試了一次,雖然沖突

但是使用tortoisegit進行對比的時候,發現向下瀏覽的沖突按鈕next confilict,是無效的

直接save,並且標記沖突為解決


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM