dmo.ca/ blog/ Merging separate git repositories

In order to keep things as seamless as possible for the next MIMEDefang upgrade, I've decided that the new modules I'm factoring out will need to live within the MIMEDefang git tree, at least for now. But... I had been working on some of the refactored code in a separate git tree, so now I need to merge it back in. Here's how I did it:

Start with a cloned MIMEDefang (the target of the merge) and an Email-VirusScan (the component being merged) in the same directory. Then:

  1. Merge Email-VirusScan into the MIMEDefang tree:

     cd MIMEDefang
     git fetch ../Email-VirusScan master:email-virusscan
    

    You now have an 'email-virusscan' branch in your MIMEDefang tree.

  2. Change the path for the component to be merged:

     git checkout -f email-virusscan
     mkdir -p perl/Email-VirusScan
     git mv Changes .gitignore lib Makefile.PL MANIFEST MANIFEST.SKIP README t perl/Email-VirusScan
     git commit -a -m 'Move to perl/Email-VirusScan before merge'
    
  3. Merge it

     git checkout -f master
     git merge email-virusscan
    

And, you're done!

Thanks again Bart for answering a few more git questions on the "right" way to do this. If you're in Ottawa, and in need of git training for your company, Bart's your man.