Created
May 20, 2019 19:50
-
-
Save jhrr/f0510f490efad1f601da4f5ebdfe58cc to your computer and use it in GitHub Desktop.
Methods to merge two git repos into one.
This file contains 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
# Brings over all tags/branches keeping history intact for the | |
# incoming remote data. | |
$ cd path/to/source-repo | |
$ git remote add target path/to/target | |
$ git fetch target --tags | |
$ git merge --allow-unrelated-histories target/some-branch | |
$ git remote remove target | |
# Or, to merge just the one branch this works but it loses all | |
# the extra history that the above method preserves. | |
$ cd path/to/source-repo | |
$ git remote add target path/to/target | |
$ git fetch target some-branch:some-branch. # Incoming name should be unique between repos I suspect. | |
$ git merge --allow-unrelated-histories some-branch | |
$ git remote remove target | |
$ git branch -D some-branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment