- ブランチのマージを試みる(これで 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 された状態になっている)。
なので、 imerge/<branch-x> を branch-mine に merge する
$ git branch
* imerge/<branch-x>
branch-mine
$ git checkout branch-mine
$ git merge imerge/<branch-x>