Created
April 1, 2014 20:28
-
-
Save wbingli/9922456 to your computer and use it in GitHub Desktop.
Merge multiple repositories into one, keep all commit history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/tdv-core | |
cd ~/tdv-core | |
#clone all repos | |
git clone [email protected]:tdigital-ondemand/tdv-core.git | |
#Clone parent firstly | |
git clone [email protected]:tdigital-ondemand/parent.git | |
cd parent | |
git checkout dev | |
cd ../tdv-core | |
git remote add parent ../parent | |
git pull --no-edit parent dev | |
git remote rm parent | |
cd .. | |
rm -rf parent | |
#billing-account-management customer-insite-management customer-problem-manager customer-self-management resource-order-manager-oot service-order-manager | |
#Merge foundation | |
for repo in foundation canonical-data-model badsanta billing-account-management customer-insite-management customer-problem-manager customer-self-management resource-order-manager-oot service-order-manager product-catalog-manager customer-information-management | |
do | |
git clone [email protected]:tdigital-ondemand/$repo.git | |
cd $repo | |
git checkout dev | |
existing=`ls` | |
mkdir $repo | |
for d in $existing | |
do | |
git mv $d $repo/ | |
done | |
#Don't forget .gitignore | |
git mv .gitignore $repo/ | |
git commit -m "Prepare $repo to merge into tdv-core" | |
cd ../tdv-core | |
git remote add $repo ../$repo | |
git pull --no-edit $repo dev | |
git remote rm $repo | |
cd .. | |
rm -rf $repo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment