Repositories: How to move content from one repository to another one
Goal
The content from the source repository should keep the Git history.
Steps
Create a new repository with the content to move:
git clone git@github.com:AlexRogalskiy/<source-repository>.git
cd <source-repository>
git-filter-repo --path <path-to-extract> \
--path <path-to-extract> \
--path <path-to-extract> \
...
Publish that new repository
Add it as a remote repository to the target repository:
git clone git@github.com:AlexRogalskiy/<target-repository>.git
cd <target-repository>
git remote add new-content <url>
git fetch new-content
Merge the extracted content:
cd <target-repository>
git merge --allow-unrelated-histories new-content/master
# (adapt the content if it's necessary)
git push origin master
Remove the published repository (step 2)
Create a pull request into the source repository to remove the extracted content
Last updated
Was this helpful?