Le Laboureur
Le Laboureur

Reputation: 159

merge branch with parents while previous merge has been revert

I know the title isn't quite clear, so here is my prob.

I got the main branch (name : integration). I created another branch for my work (name : Correction). I have made some changes and my branch has been merged into integration. But I have been away for several weeks and while I was gone the merge was revert and a lot of changes has been made into the integration branch.

My pb is that now I can't get the changes from integration without losing the changes on my own branch. Those changes will be merged again in the integration branch but later... I need to get the last updates in order to make a proper correction.

I have tried git pull, git fetch, git rebase and I have found nothing that allows me to properly merge all the modifications.

I am not sure if it's important but files were deleted, moved and renamed in some commits.

Thanks

EDIT - SOLUTION Ok, I think I got it. A schematic reminder of my situation 2 branches : integration(bI) & correction (bC)

bI -------------------------- commmits-------------> bI ->bC->(merge)/ (revert merge) ------> bC

I couldn't get the commits from bI without losing my work in bC

What I did is:

  1. create a new branch from bI Fusion
  2. git revert of the (revert merge)
  3. git merge from bC into Fusion
  4. solve conflicts manually

The conflicts weren't easy to solve but I achieved to get a branch with both work form my branch and the integration branch.

Do you guys see any better solution?

Upvotes: 1

Views: 31

Answers (1)

James McGuigan
James McGuigan

Reputation: 107

It sounds like you need to revert the revert? How about the solution provided at Re-doing a reverted merge in Git.

Upvotes: 1

Related Questions