Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: How do I merge complex branches that have widely diverged with some missing history?

I have two "branches", both of which started from the same code base, but both of which were imported to git after they diverged. The prior history is lost, and additionally both branches have extensive changes recorded in their git history.

What is a good strategy to approach merging features and bugfixes between these two branches in a manageable way?

Is there a tool that will assist me in separating differences in the original imports into meaningful commits?

like image 382
fuzzyTew Avatar asked Jan 26 '11 16:01

fuzzyTew


1 Answers

Sounds like you want to keep the history. I would use rebase --onto with --preserve-merges to move features/bugs to the branch you want to continue using. If they sit in a different structure for some reason, make a new branch then do a filter-branch with the tree operation to make the structure the same. Then rebase --onto --preserve-merges as you would in the first scenario.

Hope this helps.

like image 61
Adam Dymitruk Avatar answered Sep 18 '22 16:09

Adam Dymitruk