Created
September 6, 2017 11:27
-
-
Save betrcode/1470a6c48da36740d5e0f6cbcd4de614 to your computer and use it in GitHub Desktop.
Merge Git Repositories and Preseve Commit History by Scott W Bradley
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
# ...First create a new empty repository on github named 'simpsons'... | |
# Clone all the repos to work with | |
$ cd ~/src | |
$ git clone [email protected]:scottwb/homer.git | |
$ git clone [email protected]:scottwb/bart.git | |
$ git clone [email protected]:scottwb/simpsons.git | |
# Copy over homer to simpsons | |
$ cd homer | |
$ git remote rm origin | |
$ mkdir homer | |
$ git mv *.* homer/. | |
$ git commit -m "Prepare homer to merge into simpsons" | |
$ cd ../simpsons | |
$ git remote add homer ~/src/homer | |
$ git pull homer master | |
$ git remote rm homer | |
$ cd .. | |
$ rm -rf homer | |
# Copy over bart to simpsons | |
$ cd bart | |
$ git remote rm origin | |
$ mkdir bart | |
$ git mv *.* bart/. | |
$ git commit -m "Prepare bart to merge into simpsons" | |
$ cd ../simpsons | |
$ git remote add bart ~/src/bart | |
$ git pull bart master | |
$ git remote rm bart | |
$ cd .. | |
$ rm -rf bart | |
# Push simpsons back upstream to github | |
$ cd simpsons | |
$ git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original: http://scottwb.com/blog/2012/07/14/merge-git-repositories-and-preseve-commit-history/