I think the commands you are looking for are:
git checkout master
git remote add r1remote **url-of-repo1**
git fetch r1remote
git merge r1remote/master --allow-unrelated-histories
git remote rm r1remote
After that repo2/master will contain everything from repo2/master and repo1/master, and will also have the history of both of them.
--allow-unrelated-histories
參數(shù)需要git 2.9以上支持, ubuntu自帶源沒有,需要按照git官網(wǎng)添加源
https://git-scm.com/download/linux