Created
March 31, 2014 10:19
-
-
Save rwoeber/9889365 to your computer and use it in GitHub Desktop.
Merge Two Git Repositories Into One
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # via http://jasonkarns.com/blog/merge-two-git-repositories-into-one/ | |
| # create new project as the parent | |
| $ mkdir new_parent_project | |
| $ cd new_parent_project | |
| $ git init | |
| $ touch .gitignore | |
| $ git ci -am "initial commit" | |
| # merge project A into subdirectory A | |
| $ git remote add -f projA /path/to/projA | |
| $ git merge -s ours --no-commit projA/master | |
| $ git read-tree --prefix=subdirA/ -u projA/master | |
| $ git ci -m "merging projA into subdirA" | |
| # merge project B into subdirectory B | |
| $ git remote add -f projB /path/to/projB | |
| $ git merge -s ours --no-commit projB/master | |
| $ git read-tree --prefix=subdirB/ -u projB/master | |
| $ git ci -m "merging projB into subdirB" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment