Top/VersionCtl/git/git-imerge

目次

git-imerge - incremental merge for git

準備

コマンド

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

手順

merge

  1. ブランチのマージを試みる(これで 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
  2. 上記 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
  3. 通常の手順で conflict 編集を行う
  4. conflict 解消したファイルについて git add まで行う(git commit しないこと!!
  5. 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
  6. また 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
  7. 最終的に 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!
  8. 最終的に 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
  9. 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


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-01-05 (水) 01:03:16