码迷,mamicode.com
首页 > 其他好文 > 详细

git整理纷乱的历史合并记录

时间:2015-10-25 06:15:43      阅读:412      评论:0      收藏:0      [点我收藏+]

标签:

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,并且标记冲突为解决

git整理纷乱的历史合并记录

标签:

原文地址:http://www.cnblogs.com/chucklu/p/4908177.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!