Git: Merge Unrelated Repos

Tagged as:

So I have this repo - [email protected]:k4ml/k4ml.github.io.git and I want to merge
it with [email protected]:barryclark/jekyll-now.git. Both repos are not related.

git clone [email protected]:k4ml/k4ml.github.io.git
cd k4ml.github.io
git pull -s recursive -X theirs [email protected]:barryclark/jekyll-now.git master

You’ll see a warning about no common commits but the merge proceed:-

warning: no common commits
remote: Counting objects: 1257, done.
remote: Total 1257 (delta 0), reused 0 (delta 0), pack-reused 1257
Receiving objects: 100% (1257/1257), 8.17 MiB | 1.09 MiB/s, done.
Resolving deltas: 100% (698/698), done.
From github.com:barryclark/jekyll-now
 * branch            master     -> FETCH_HEAD
 Auto-merging index.html
 Auto-merging about.md
 Auto-merging README.md

The theirs merge strategy option mean if there’s conflict (similar filename for example), the incoming
version will be used.

I’d first seen this being used in Openshift example.

Other merge tips from Orchestra project - http://read.cookbook.orchestraplatform.com/installation/sync.html.

Written on January 28, 2016 by kamal
About author

Lead Engineer at Xoxzo Inc. Develop web applications in Python/Django. Interested in open source and tech talent development.

Xoxzo.com provide API services for developer to develop messaging and voice based application. The postings on this site are my own and don't necessarily represent my employer's positions, strategies or opinions. I can be reached via Twitter @k4ml.

Ikuti perkembangan terkini melalui twitter kami @koditi atau FB Page fb.me/koditi.