Jul 22, 2009

How to merge two independent git repositories

I have two independent repositories (A and B) and would like to merge one repo. (B) into another one (A) with keeping the whole history of both. What do to?
With git it appeared to be a very easy task.

cd A
git remote add test ../B && git fetch test
git merge test/master
git push (if you use a remote repo.)

That's it.

You can also merge a subdir of one repo. into another. But to do so you need to use git filter-branch.

I love git! ;)


masha said...

Thanks, this was exactly what I was looking for.

Dmitry said...

Thank you, was really useful! :)

Anar Manafov said...

you are welcome ;)
Git is awesome!

Anonymous said...

Thank you. I am little new to git and was looking for this feature for one of my projects. Your post was very very helpful.

Anar Manafov said...

;) You are welcome!

Anonymous said...

You just saved me some hours of my life. Thanks.

Anar Manafov said...

;) Thanks for the comment!

me said...

Awsome, this made my day... I spent 30 minutes reading complicated ways to do this and I had it done this way in 15 minutes...

Good work!

redhot said...

Thanks! Your blog lays this out very simply. For folks who want to meld two git repos that involves pruning and grafting, this blog gives a run book-


Gordon Barrs said...

+1 for what me said. Thanks for taking the time to post.

Anonymous said...

thanks for share.

Anonymous said...

you are the man. :)

oakleyses said...

louboutin pas cher, nike free, polo ralph lauren outlet online, louis vuitton, polo outlet, nike air max, longchamp pas cher, jordan shoes, ray ban sunglasses, gucci handbags, tiffany and co, jordan pas cher, cheap oakley sunglasses, louis vuitton outlet, oakley sunglasses, christian louboutin uk, nike free run, sac longchamp pas cher, nike air max, oakley sunglasses, longchamp outlet, prada outlet, kate spade outlet, longchamp outlet, louis vuitton, oakley sunglasses wholesale, polo ralph lauren, longchamp outlet, christian louboutin outlet, chanel handbags, louis vuitton outlet, tiffany jewelry, michael kors pas cher, replica watches, replica watches, ray ban sunglasses, ugg boots, burberry pas cher, tory burch outlet, nike roshe, oakley sunglasses, louis vuitton outlet, ray ban sunglasses, prada handbags, ugg boots, nike outlet, christian louboutin shoes, uggs on sale, christian louboutin

oakleyses said...

guess pas cher, north face, lululemon canada, michael kors, michael kors outlet online, true religion outlet, oakley pas cher, nike free uk, michael kors outlet, abercrombie and fitch uk, hollister uk, true religion outlet, hollister pas cher, ray ban pas cher, polo lacoste, north face uk, michael kors outlet online, coach outlet store online, ray ban uk, mulberry uk, burberry handbags, michael kors outlet, hogan outlet, nike blazer pas cher, nike air max, nike air max uk, true religion outlet, uggs outlet, coach outlet, nike air force, nike air max uk, sac hermes, uggs outlet, michael kors outlet, michael kors, michael kors outlet online, nike roshe run uk, vans pas cher, true religion jeans, replica handbags, ralph lauren uk, sac vanessa bruno, burberry outlet, nike tn, coach purses, new balance, michael kors outlet online, kate spade, timberland pas cher

oakleyses said...

hermes belt, hollister, lancel, abercrombie and fitch, chi flat iron, instyler, north face outlet, louboutin, asics running shoes, nfl jerseys, ferragamo shoes, new balance shoes, mont blanc pens, vans outlet, celine handbags, hollister clothing, mcm handbags, mac cosmetics, beats by dre, giuseppe zanotti outlet, converse outlet, nike air max, longchamp uk, oakley, reebok outlet, bottega veneta, nike air max, timberland boots, insanity workout, nike trainers uk, gucci, lululemon, baseball bats, soccer shoes, soccer jerseys, north face outlet, valentino shoes, wedding dresses, hollister, nike roshe run, vans, ray ban, babyliss, jimmy choo outlet, nike huaraches, p90x workout, ghd hair, ralph lauren, herve leger, iphone cases

oakleyses said...

ugg,uggs,uggs canada, barbour uk, moncler outlet, coach outlet, ugg,ugg australia,ugg italia, moncler, thomas sabo, canada goose, moncler outlet, links of london, canada goose outlet, juicy couture outlet, moncler uk, pandora jewelry, montre pas cher, marc jacobs, replica watches, louis vuitton, moncler, canada goose jackets, swarovski, pandora charms, canada goose outlet, toms shoes, moncler, swarovski crystal, doudoune moncler, louis vuitton, moncler, pandora jewelry, ugg, barbour, louis vuitton, hollister, canada goose outlet, karen millen uk, ugg pas cher, supra shoes, canada goose, juicy couture outlet, louis vuitton, wedding dresses, pandora uk, canada goose, ugg uk, canada goose uk, louis vuitton

Pinky Preeto said...

Happy Friendship day images
Guru Purnima images
open championship 2016
british open 2016 leaderboard
Happy eid mubarak images
sultan total box office collection
tour de france 2016 route

Pradeep Sharma said...

happy friendship day images with quotes
happy friendship day quotes with images
Friendship Day Messages In Hindi
friendship day WhatsApp status
Friendship Day greeting cards
happy friendship day to my love
Friendship Day SMS In English
Friendship day 2016 pics
happy friendship day hindi status
happy friendship day quotes with images
Friendship day Wishes 2016

rajkumar mali said...

70th Happy Independence Day India, 15th August Essay, Happy 15th August 2016 Images, Independence Day Essay, India's independence day Status, Independence day Status in Hindi & English. Happy 15th August Whatsapp Status, Dp Images, Short Independence Day Speech, Happy Independence Day Images, Quotes, Wishes, Sayings, Poems, Messages, Happy Independence Day Slogans
happy Independence day Status in Hindi & English
happy Independence day Whatsapp Status
Independence day greetings
Independence day speech for Students
15 August Messages
India's Independence day 2016 Shayari and Messages
independence day images
independence day pictures
independence day wallpapers
independence day pics
independence day photos
happy independence day images
happy independence day photos
images for independence day
independence day images hd
Independence day facebook profile pictures
happy indnependence day 2016 images
Independence day speech for Teachers and Students
Happy Independence day Facebook Status Images

Happy Teachers Day 2016 said...

The Beautiful collection of Happy Teachers Day Images HD, Quotes, Messages, Poems, Photos, Pictures, Wallpapers, Teachers Day Status in Hindi, Shayari, SMS, Messages, Wishes, Pictures, Pics, Profile Photos, Teachers Whatsapp Status in Hindi etc.
Teachers Day
Happy Teachers Day
Teachers Day Quotes
Teachers Day Wishes
Quotes on Teachers Day
Teachers Day Messages
Teachers Day Cards
Teachers Day Greeting Cards
Teachers Day SMS
Teachers Day Status in Hindi
Teachers Day Whatsapp Status
Teachers Day Images HD
Teachers Day Shayari

rajkumar mali said...

The best blog of Happy janmashtami Images HD, janmashtam Quotes, Messages, Poems, Photos, Pictures, janmashtami HD Wallpapers, Happy
janmashtami Status in Hindi, Shayari, SMS, Messages, Wishes, Pictures, Pics, Profile Photos, janmashtami Whatsapp Status in Hindi etc.
janmashtami Images HD
janmashtami Quotes
janmashtami Messages
janmashtami SMS
janmashtami Wishes
janmashtami Greeting

pooja saini said...

The Beautiful and latest collection of Happy Ganesh Chaturthi Images HD, Quotes, Messages, Poems, Photos, Pictures, Wallpapers, Ganesh Chaturthi Status in Hindi, Englilsh, Marathi, Tamil. Shayari, SMS, Messages, Wishes, Pictures, Pics, Profile Photos, Ganesh Chaturthi Whatsapp Status in Hindi, English & Marathi etc.
Ganesh Chaturthi HD Images
Ganesh Chaturthi HD Wallpapers
Lord Ganesha Images
Ganesh Chaturthi Whaatsapp Status
Ganesh Chaturthi HD Images
Ganesh Chaturthi Whatsapp DP Images
Ganesh Chaturthi Facebook Profile Pics
Ganesh Chaturthi Photos
Teachers Day
Teachers Day HD Images
Teachers Day Pictures
Teachers Day Facebook Profile Pics
Teachers Day Whatsapp DP Images
Happy Teachers Day Images HD
Teachers Day Wallpapers
Teachers Day Pics
Teachers Day Photos
Happy Teachers Day Quotes
Happy Teachers Day Wishes
Happy Teachers Day Messages
Happy Teachers Day Greetings Cards

pooja saini said...

Happy Diwali HD Images, Quotes, Messages, Poems, Photos, Pictures, Wallpapers, Happy Diwali Status in Hindi, Shayari, SMS, Messages, Wishes, Pictures, Pics, Profile Photos, Happy Diwali Whatsapp Status in Hindi etc.
diwali hd images
poem on diwali
diwali greetings
diwali photos
Happy diwali Profile Pics
Happy Diwali Greetigns Cards Images
Happy diwali HD Wallpapers
happy diwali images for Whatsapp
happy diwali images HD
happy diwali HD photos free download
diwali pictures
diwali wishes
diwali hindi
diwali SMS
diwali Messages
diwali Wishes
diwali greetings messages english
happy diwali Whatsapp DP Images
happy diwali Messages in Hindi
happy diwali Pems
Happy Diwali Facebook Images

Raja Shrama said...

Advance Happy Diwali SMS Wishes messages whatsapp status images hd wallpapers pictures choti badi shubh deepavali 2016 happy diwali greeting cards

Paweł Nwrot said...

forina pure

Valentine Greetings said...

Valentines Day Purpose Day 2017
Romantic Valentines Day Ideas For Boyfriend
Happy Valentine's Day 2017

All Festival Images said...

Really nice post and thanks for Happy Holi Wallpapers sharing.

Laxmi Devi Saini said...

Best pranks
April Fools pranks
April Fools day pranks
April Fool day
April Fools jokes

rajkumar mali said...

easter religious images
easter egg images
free easter pictures
easter pictures free
easter images jesus
easter bunny images
pictures of easter eggs
happy easter cards
free easter images
pictures of easter bunny