Merge Two Unrelated Git Repository
Considering others have downloaded a repo and developed in local git environment with brand new git history such that it cannot be merge back to the repo where it was initially cloned from. How to merge the two repo without losting git history?
Considering others have downloaded a repo and developed in local git environment with brand new git history such that it cannot be merge back to the repo where it was initially cloned from.
How to merge the two repo without losting git history?
Key steps
- Main repo: the original/targeted repo
- Other repo: the new repo with interrupted git history
In local environment, have the two repo ready locally in the following file structure:
├─mainrepo
└─otherrepo
cd /path/to/mainrepo
git remote add NAME_IT ..\otherrepo
git fetch NAME_IT
git merge NAME_IT/master --allow-unrelated-histories
git log