2

I have two separate git repositories for the same version of a single website.

domain.com-1.0
domain.com-2.0

Version 2.0 was completely redone from the ground up. There is no bridge between the two repositories. I would now like to merge the two into a single repository, but maintain the separation.

I have already tagged domain.com-1.0 in it's repo and now want to clean the working tree and move domain-2.0 and all it's commit history into 1.0's repo. Is this possible or is there a better way of accomplishing this?

Note: domain.com-1.0 will not be developed on anymore and is "being retired".

PHLAK
  • 22,023
  • 18
  • 49
  • 52
  • http://stackoverflow.com/questions/1141338/git-question-possible-to-merge-two-different-by-equal-repositories/1141557#1141557 could help here. – VonC Apr 22 '10 at 21:15
  • Hmmm... something like that MIGHT work. I'll look into that later. – PHLAK Apr 22 '10 at 21:46

1 Answers1

2

I would solve this as follows:

  1. git remote add the foo-2.0 to the foo-1.0 repo

  2. git fetch the stuff from foo-2.0 to the foo-1.0 repo

  3. Fire up gitk --all to see the branches and do some proper branch (re)naming.

This should work for simple one-off cases. If you need to do this twice a day, you should think up a way to automate step 3.

ndim
  • 35,870
  • 12
  • 47
  • 57
  • Why would I need to merge any branches? The two repos are completely separate and I'm just going to keep 2.0 in a tag for reference purposes only. – PHLAK Apr 22 '10 at 22:28
  • Merge branches? You do not merge any branches. However, foo-1.0's master branch is there, and then there will be foo-2.0's remote2/master branch. You will want a local branch for remote2/master... so you will need to give that a new name, or call the old master something else and use master as the name for foo-2.0's master... however you want to name that. – ndim Apr 22 '10 at 23:19