0

I'm new to git, and haven't been able to find an exact answer to this on SO.

We have two repositories that customise two Android releases, PRODUCT_4.4.0 and PRODUCT_5.1.1. We now realise that we should just have had a single repository, PRODUCT, and branched it at the end of the 4.4.0 development, and continued with the 5.1.1 development in the same repository.

I would like to merge these two repositories into one repository called PRODUCT, with a branch 4.4.0 before the 5.5.1 commits. I would also like to copy across the full commit history.

I've found this and this on SO, but as far as I can tell, they don't exactly fit my needs.

Can this be done?

Many thanks, Paul

Community
  • 1
  • 1
Paul
  • 443
  • 8
  • 18
  • You have 2 branch PRODUCT_4.4.0 and PRODUCT_5.1.1. Does your branch PRODUCT_5.1.1 contents PRODUCT_4.4.0 changes? Have you merged PRODUCT_4.4.0 with PRODUCT_5.1.1? – Deepak Biswal Jul 31 '15 at 11:31
  • @Deepak, No, I have two **separate** git repositories, where all development was done on the master branch of each. I want to merge them, as described in my original question – Paul Jul 31 '15 at 11:44

1 Answers1

0

The simplest way would be to pull the branch you want to merge from PRODUCT_4.4.0 stuff into a branch in PRODUCT_5.1.1 repo and then merge it into branch already exist in PRODUCT_5.1.1. And then finally you can create a new repo and pull the branch which you merged in the PRODUCT_5.1.1 repo.

Hope this will help!

Deepak Biswal
  • 4,280
  • 2
  • 20
  • 37
  • Sorry I don't understand yor reply. I want a new repository, PRODUCT, consisting of the series of commits A1...An from the existing PRODUCT_4.4.0 repository, followed by the commits B1...Bn from the PRODUCT_5.1.1 repository. I also want a branch at the end of the A1..An commits in this new repository. Is this possible? – Paul Jul 31 '15 at 11:56
  • Create a new branch called B2 in 5.1.1 repo. Pull codes from 4.4.0 A1 branch to B2. Then merge B1 to B2. Now B2 have all the changes from A1 and B1. Does that make sense? – Deepak Biswal Jul 31 '15 at 11:58