brew install git-filter-repo
# or just download the single python file
git clone [email protected]:YOUR_ORGANIZATION/repo1.git tmprepo1
git clone [email protected]:YOUR_ORGANIZATION/repo2.git tmprepo2
The single quotes are unnecessary, but make it clearer to a human that we are replacing the empty string as a prefix with my-module-
cd tmprepo1/
git filter-repo --path subfolder --tag-rename '':'subfolder-prefix-'
# or
git filter-repo --path subfolder --to-subdirectory-filter move-to-this-folder --tag-rename '':'subfolder-prefix-'
cd tmprepo2
git remote add tmpremote $HOME/workspace/tmprepo1
git fetch tmpremote
git checkout -b imported-branch tmpremote/main
git rebase main
git remote remove tmpremote
git push -u origin imported-branch