Re-use conflict resolution with Git

后端 未结 1 1430
忘掉有多难
忘掉有多难 2021-01-04 20:12

Can I tell Git to re-use the conflict resolution from an existing merge commit? I had rerere disabled at the time of commit. The new merge commit contains a few additional c

相关标签:
1条回答
  • 2021-01-04 20:48

    The simplest way to implement what you're asking for is probably to retroactively turn rerere on:

    git config rerere.enabled true    # with rerere turned on,
    
    git checkout $o^1             # rerun the original merge
    git merge $o^2
    git read-tree --reset -u $o:  # resolve conflicts exactly as before
    
    git commit                    # throwaway commit to feed the results to rerere
    

    and now that rerere has seen what you did with those conflicts,

    git checkout -B old-master $o^1   # rewind `old-master` to before the merge
    git merge master              # rerun it with current ancestry
    
    0 讨论(0)
提交回复
热议问题