Repeat poor resolution git permissions after clicking

I want to recreate a merge conflict so that I can correctly resolve it a second time.

Example:

  • Check box "A" selected.
  • Branch 'B' merged into.
  • Conflicts resolved by merge (created by merge).
  • Press on the remote control.
  • Other people merge into Branch 'A' and click on the remote.
  • Oh my god, I realized that my resolution of the conflict was wrong, I went with them instead of me, no matter what.
  • Now what?

I really want to re-execute part of the resolution of the conflict .

I have no way to reinstall my HEAD, as the branch has already been pressed on the console; and has the possibility of other people committing on it before I realized that the resolution of the conflict was wrong.

I also want to avoid a direct fix in branch "A".

I want to avoid cherry picking. I know that I can make a standard return, and cherry pick my commits, etc., I do not want to do this.

Is there any elegant way to do this?

I tried to return a merge commit, and then returned and changed branch "B" again , but, unfortunately, he did not ask me to resolve conflicts a second time , I just get the standard message "Already updated".

Putting it simply, I want to recreate my conflict so that I can correctly resolve it a second time.

Any help would be greatly appreciated.

Thanks.

+5
source share
1 answer

There are two steps. First merge and conflict are recreated. The second applies it to the new end of the branch.

You have something like this.

1 - 2 - 5 - 6 - 7 - 9 - 10 [A] \ / 3 - 4 - 8 

7 is a merge fix, and you want to repeat this and apply corrections on top of A. Rebasing can become messy because too much work was put on top.

First, let it recreate the merger conflict. To do this, we just do it again. Place order 6, where A was when you merged, and combine it with 8.

 git checkout 6 git merge 8 

You will need to use git log --graph to determine the valid commit identifiers. Now we have a merge conflict. Allow it, as you would , but do not commit it . Put it in instead. git stash save . This will save the diff in the corner called "stash" . This is just a more formal way of saving patches.

Now that we have the resolution of the conflict, as it would be, check A and apply the fix from stash.

 git checkout A git stash pop 

Since there has been a change in A, you can get fresh conflicts from this. It's great. Allow them normally and commit.

+6
source

Source: https://habr.com/ru/post/1265887/


All Articles