How to combine multiple GIT repositories into a repository

I have three repositories, I want to combine into a respository.

For example:
repository01,url:remote_repository01_url
repository02,url:remote_repository01_url
repository03,url:remote_repository01_url



Step1:Build a new repository.
mkdir new_respository
cd new_respository
git init
echo "combine git" >> README.md
git add README.md
git commit -m 'initial git repository'

Step2:Merge new_respository and repository01.
#add remote repository and merge to new_respository
git remote add repository01_name remote_repository01_url
git fetch repository01_name
git checkout -b repository01_name repository01_name/master
git checkout master
git merge repository01_name
# save merged message

Step3:Move repository01 to new location in new_repository
mkdir repository01
git mv * repository01/
# You should move files or directories that do it a object by a command.
git commit -m 'move repository01 source'
git remote remove repository01

Final:
I just repeat Step2 and Step3 for other repostories.

留言

此網誌的熱門文章

nginx 上安裝 TWCA 憑證

PSPAD / NOTEPAD++ 好用功能