Last active
August 12, 2017 11:40
-
-
Save gghughunishvili/41bca7d789e3d159feff4b24f8c17d48 to your computer and use it in GitHub Desktop.
Move one repository into another (merging) without losing history
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
# Caution: new repo should be empty otherwise you lose new repo data! | |
git clone --mirror <url_of_old_repo> | |
cd <name_of_old_repo.git> | |
git remote add new-origin <url_of_new_repo> | |
git push new-origin --mirror | |
# if you want merge two repositories you should use the following commands | |
# merging project-a into the project-b | |
cd <path_to_project_b> | |
git remote add project-a <url_of_project_a> | |
git fetch project-a | |
git merge --allow-unrelated-histories project-a/master # or whichever branch you want to merge | |
git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment