combine-git-repos

A tool for combining git repositories without losing history

combine-git-repos

This is a quickly written package, not tested at all! WOMM.

This is an implementation of the manual process described here.


$ npm install combine-git-repos

var combineGitRepos = require('combine-git-repos')
 
var firstRepo = '/Users/you/full/path/to/firstRepo';
var secondRepo = '/Users/you/full/path/to/secondRepo';
var targetFolder = '/full/path/to/repoToBeCreated';
 
combineGitRepos.clone(firstRepo, targetFolder)
  .then(function(newRepo) {
    return combineGitRepos.mergeRepoIntoRepo(secondRepo, newRepo, 'folderForSecondRepo');
  })
  .then(console.log)
  .catch(function(err) {
    throw new Error(err);
  });
 

In this example I clone the first repo so that it would not be changed. (but do not trust me, play safe!).

This can also be seen here, and this is an example of combining an arbitrary number of repos.


As mentioned above, this hasn't been tested. It works on my machine well, but who knows? Use cautiously.


  • If you enjoyed this tool, please star it on Github!
  • I'd love to get any feedback you might have! Mail me at danyshaanan@gmail.com, or open an issue.
  • More material appreciation is welcome in the form of bitcoins. My address can be found on this page.