#author("2022-01-04T16:02:23+00:00","","")
#author("2022-01-04T16:03:16+00:00","","")
#topicpath

///////////////////////////////////////////////////////////////////////////////
* 目次 [#s2cfc07e]
#contents();

///////////////////////////////////////////////////////////////////////////////
* git-imerge - incremental merge for git [#oe28e24c]
- 2つのブランチ間のマージで conflict が発生する場合に、その conflict を段階的に1対ずつ提示する。
- これは、競合対を1対ずつ解消することにより、通常の1回のマージで多数の commit が conflict する際の複雑さを回避しながらより正確な conflict 編集を行うための助けになると考えられる。

///////////////////////////////////////////////////////////////////////////////
* 準備 [#zfc40089]
- debian では以下のパッケージを導入する
 git-imerge

///////////////////////////////////////////////////////////////////////////////
* コマンド [#z71f579d]
|~git-imergeコマンド                  |~git analogue                      |~description |
|git-imerge merge BRANCH             |git merge BRANCH                   |現在のブランチにブランチをマージします。 |
|git-imerge rebase BRANCH            |git rebase BRANCH                  |ブランチの上に現在のブランチを再BRANCH |
|git-imerge revert COMMIT            |git revert COMMIT                  |COMMITの効果を元に戻す新しいコミットを追加する |
|git-imerge revert COMMIT1..COMMIT2  |git revert COMMIT1..COMMIT2        |COMMIT1..COMMIT2の影響を取り消す新しいコミットを追加する |
|git-imerge drop COMMIT              |git rebase --onto COMMIT^ COMMIT   |現在のブランチの履歴からCOMMITを完全に削除する |
|git-imerge drop COMMIT1..COMMIT2    |git rebase --onto COMMIT1 COMMIT2  |完全に削除すると、現在のブランチの履歴からCOMMIT1..COMMIT2がコミットされCOMMIT1..COMMIT2 |



///////////////////////////////////////////////////////////////////////////////
* 手順 [#ue6ced0e]
//=============================================================================
** merge [#uba35c7d]
- 以下、 merge 対象を <branch-miine>, merge で取り込む相手側ブランチを <branch-x> で表すものとする
+ ブランチのマージを試みる(これで conflict が発生する前提)
 $ git-imerge merge <branch-x>
 Attempting automerge of 1-3...failure.
 Attempting automerge of 1-1...success.
 Attempting automerge of 1-3...failure.
 Attempting automerge of 1-2...failure.
 Autofilling 1-1...success.
 Recording autofilled block MergeState('<branch-x>', tip1='<branch-mine>', tip2='<branch-x>', goal='merge')[0:2,0:2].
 Attempting automerge of 1-3...failure.
 Attempting automerge of 1-2...failure.
 Switched to branch 'imerge/<branch-x>'
 Auto-merging GNUstep/Defaults/WMWindowAttributes
 CONFLICT (content): Merge conflict in GNUstep/Defaults/WMWindowAttributes
 Auto-merging GNUstep/Defaults/WMState
 CONFLICT (content): Merge conflict in GNUstep/Defaults/WMState
 Automatic merge failed; fix conflicts and then commit the result.
 ...
 (以下、commit log が表示される)
 ...
 There was a conflict merging commit 1-2, shown above.
 Please resolve the conflict, commit the result, then type
 
     git-imerge continue
+ 上記 conflict が発生した旨メッセージが出ているので、状態を確認する
 $ git st
 On branch imerge/<branch-x>
 You have unmerged paths.
   (fix conflicts and run "git commit")
   (use "git merge --abort" to abort the merge)
 
 Changes to be committed:
 	modified:   GNUstep/Defaults/WindowMaker
 	modified:   GNUstep/Library/WindowMaker/autostart
 
 Unmerged paths:
   (use "git add <file>..." to mark resolution)
 	both modified:   GNUstep/Defaults/WMState
 	both modified:   GNUstep/Defaults/WMWindowAttributes
+ 通常の手順で conflict 編集を行う
+ conflict 解消したファイルについて git add まで行う(''git commit しないこと!!'')
+ conflict を解消したら、merge 作業を継続する(git-imerge continue を実行)
 $ git-imerge continue
 [imerge/<branch-x> 2acde86] imerge '<branch-x>': manual merge 1-2
 Merge has been recorded for merge 1-2.
 Attempting automerge of 1-3...failure.
 Attempting automerge of 1-3...failure.
 Switched to branch 'imerge/<branch-x>'
 Auto-merging GNUstep/Defaults/WMWindowAttributes
 CONFLICT (content): Merge conflict in GNUstep/Defaults/WMWindowAttributes
 Automatic merge failed; fix conflicts and then commit the result.
 
 Original first commit:
 commit 06472e9c1c3fef6d2c8ff2b9fa2c1765accd2f0d (origin/<branch-mine>, origin/HEAD, refs/imerge/<branch-x>/manual/1-0, <branch-mine>)
 ...
 (以下、commit log が表示される)
 ...
 
 There was a conflict merging commit 1-3, shown above.
 Please resolve the conflict, commit the result, then type
 
     git-imerge continue
+ また conflict が発生したので、再度状態を確認
 $ git st
 On branch imerge/<branch-x>
 You have unmerged paths.
   (fix conflicts and run "git commit")
   (use "git merge --abort" to abort the merge)
 
 Changes to be committed:
 	modified:   GNUstep/.AppInfo/WindowMaker/History
 	modified:   GNUstep/Defaults/WMState
 	new file:   GNUstep/Library/WindowMaker/CachedPixmaps/xterm.UXTerm.xpm
 
 Unmerged paths:
   (use "git add <file>..." to mark resolution)
 	both modified:   GNUstep/Defaults/WMWindowAttributes
+ 最終的に conflict が解消するまで、git-imerge continue と conflict 編集, git add を繰り返す
 $ git-imerge continue
 [imerge/<branch-x> e578941] imerge '<branch-x>': manual merge 1-3
 Merge has been recorded for merge 1-3.
 Merge is complete!
+ 最終的に conflict 解消が完了したら、git-imerge による merge 作業を完了する
 $ git-imerge finish
 [<branch-mine> dcbf792] Merge <branch-x> into <branch-mine> (using imerge)
  Date: Tue Jan 4 19:15:49 2022 +0900
+ merge の結果は <branch-mine> ではなく imerge/<branch-x> に出来る模様(そしてこれが checkout された状態になっている)。~
+ merge の結果は <branch-mine> ではなく imerge/<branch-x> に作られる模様(そしてこれが checkout された状態になっている)。~
なので、 imerge/<branch-x> を <branch-mine> に merge する
 $ git branch
 * imerge/<branch-x>
   <branch-mine>
 
 $ git checkout <branch-mine>
 $ git merge imerge/<branch-x>



///////////////////////////////////////////////////////////////////////////////
* link [#fc8253c4]
- [[git-imerge – gitのインクリメンタルマージ – GitHubじゃ!Pythonじゃ!>https://githubja.com/mhagger/git-imerge]]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS