I have github repo with 2 folders: client/server. I need to make separate repositories from these folders, but so that the commit history for each repository is not lost. After that, the main repository must be deleted. I came across the filter-repo utility on the Internet, but I didn't really figure out how it works. Could you help with that?
MAIN-REPO:
.git
client
server
expected result:
client:
.git
server:
.git
thx!
subtree split
subtree split
will "split" your content into branches
git subtree split <path> -b <branch>
and then add remote for each submodule and push the branch to the remote.
# split the "main repo" into branches and preserve full history
git subtree split -P client -b <client>
git subtree split -P server -b <server>
# For each branch that you extract client/server
# create a git repo (which will be used for submodules)
# Add the content to the git server
# add remote for client
git remote add submodule1 <client_url>
# push the submodule
git push submodule1 <branch>
# Add the submodules
git submodule add <url>
Once all your submodules are added commit the .gitmodules
file