Record a git merge process conflict resolution process

Time:2021-11-25

After a function development is completed, you are ready to merge the feature branch into the development branch. When you raise PR and merge the feature branch into the development branch, you find an exception when viewing diff. Before preparing to merge, the development branch has been merged into the feature branch, and the modified part is only in a special module A. theoretically, the result of diff should only include the modified module a, but there are a large number of modifications to other modules B, and it is strange that even the old operation record overwrites the new operation record, That is, the old record of moduleb from the merge of the development branch to the feature branch overwrites the new record of moduleb on this development.

During debugging, find the latest normal commit first_ 0, and then view it one by one from commit_ 0 to recent commit_ For all last commits, it is found that there are problems with two commits. One is to select the automatic format on submission and format the code of module B. before this time, I tried to revert, but actually only the local branch was reverted. When pushing to remote, it was merged with the original branch again, resulting in the failure of revert. Another commit shows that all the old operations have been resubmitted in the operation record. Although the code has not been modified, the time stamp of the code has been modified, which leads to the phenomenon that when the new operation of developer is merged into the feature branch, the new operation is overwritten by the old operation.

During the repair process, branch the feature to revert to the normal commit_ 0, and select soft revert, that is, keep all the commits, then revert all the modifications of moduleb, and then resubmit. Problem solved!