Merging git repositories without lose commits history

git init
dir > README.md
git add .
git commit -m "Create README.md"
git remote add merge_repo <repo URL>
git fetch merge_repo
git merge merge_repo/master --allow-unrelated-histories
mkdir FirstRepoFolder
git mv <files> ./FirstRepoFolder
git commit -m "docs: move FirstRepo into a paste"
git remote set-url merge_repo <repo URL>
git fetch merge_repo
git merge merge_repo/master --allow-unrelated-histories
mkdir SecondRepoFolder
git mv <files> ./SecondRepoFolder
git commit -m "docs: move SeconddRepo into a paste"

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

👩‍🌾Bybit Launchpool — RunNode: Stake, Study & Share for 3,900,000 RUN Prize Pool!👩‍🌾

Event-driven Microservices with Quebic

Julia vs Python for Data Science in 2022

Programming is boring art

Stop Messing With Kubernetes Finalizers

How to do Unit Testing in Flask and find Code Coverage

How To Read Properties File In Java

What is a code review?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store