Merge 2 Git repositories

Merge 2 unrelated repositories into one.
git

Sometimes it is necessary to combine 2 different Git repositories with preservation of both histories. In this example I assume that we only have one active branch (master) around that none of the files are duplicates.

Follow these steps

git remote add <tmp name of 2nd repo> <URL of second repo>
git pull <tmp name of 2nd repo> master --allow-unrelated-histories
git remote rm <tmp name of 2nd repo>