Git: How to fix a failed merge after more commits have occurred?

One of my team members worked on the function division. Then he combined our magic branch into his functional branch, but apparently only accepted his changes, not one of the (large) changes from the master was recorded in the merge.

So the commit looks like this:

Commit: 1a168acc1bbabcdc68ad6310e8cf521cc32cc708 [1a168ac]
Parents: cf8f0a4898, 59232d8d24

Check-in comments about minor changes to two small files

So effectively, he destroyed the changes in the master.

Then a few more commits were applied to the feature branches, and he issued a pull request (we use GitHub, and he pressed his branch there).

Now, when I do a merge, he, of course, does not make all the important changes on the host. What I would like to do is fix a broken merge, if possible. Or repeat the merge. Or even extract differences from this fixer and simply reapply them at an earlier point.

In this case, the commit is small enough to repeat manually, but I would like to know how to do it correctly.

+3
source share
1 answer

I'm not sure if this is the best solution, but I reset my head to commit immediately before the failed merge. Then I discovered that by making a cherry capture of the merge commit and selecting the function branch as the main line, I could get the commit without tracking the merge:

git cherry-pick 1a168acc -m 1

, , .

, , .

0

All Articles