git merge two repos

To merge two different repos and keep histories is very easy with git:

First create a branch for the other project

git checkout master
git checkout -b other-project-branch

Then add a remote that points to the other project

git remote add remote-repo gitosis@myserver.com:otherproject.git

Finally, fetch and merge

git fetch remote-repo
git merge remote-repo/other-project-branch #SEE NOTE BELOW!

NOTE: If you know that the other project will cause a merge conflict and you want to force the merge then use:

git merge -s recursive -X theirs remote-repo/other-project-branch