Как объединить два репозиторию GIT
# The goal is to merge proj-a into proj-b
cd /path/to/proj-b
# Establish remote connection from proj-a to proj-b
git remote add old /path/to/proj-a
# Assuming both projects HEAD are pointed to master branch
# I'm using master in these examples feel free to use main if you like
# Rename the local master branch of proj-b
git checkout master
git branch -m master-holder
# Pull the the code from proj-a into proj-b
git fetch old master
git checkout --track old/master
git pull old master
# The master branch is proj-a while the master-holder is proj-b
# Now clear out all the files to have a clean merge
rm -rf *
rm .gitignore
# Only thing that should exist is the .git folder
git add .
git commit -m "Clean merge"
# Now the fun part
# Merge the master-holder branch into master
git merge master-holder --allow-unrelated-histories
# Write a comment to the commit
# I said "Merge histories"
# Make master your main branch again
git branch -m master
# Done!
# Now you should be to see the combined histories
git log
#####################
# Optional: CLEANUP #
#####################
# You no longer need master-holder branch
git branch -D master-holder
# You no longer need the remote connection since you have synced histories
git remote remove old
# Complete
Bad Bat