Created
December 1, 2017 12:02
-
-
Save EnchanterIO/29976a17d5ad26ebcfbb05c4eacb5073 to your computer and use it in GitHub Desktop.
Merge unrelated git repositories into monolith and preserve history
This file contains 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
Goal: | |
Move vendor repository to "src" directory of the project while keeping git files history. | |
Folder: buzz-platform | |
git checkout -b release-pop | |
Navigate outside the repository: | |
cd ../ | |
Clone first vendor repo | |
git clone [email protected]:trivago/buzz-frontend-core-bundle.git frontend | |
Remove all files except the desired sub folder | |
cd frontend | |
git filter-branch --subdirectory-filter src/Buzz -- --all | |
Return to buzz-platform and create a origin pointing to new clean FrontendCoreBundle that is going to be merged | |
cd ../buzz-platform | |
git remote add frontend ../frontend | |
git fetch frontend | |
git merge --allow-unrelated-histories frontend/release | |
git mv FrontendCoreBundle src/Buzz/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment