You need the following info which can be found in the .gitmodules file of the release:
- Path to the submodule.
- Tracking branch (
git config --file .gitmodules submodule."${Path}".branch
). - URL of the repository (
git config --file .gitmodules submodule."${Path}".url
).
First, remove the submodule:
git rm "${Path}"
git commit --message "remove ${Path} submodule"
Second, add the code via git-subtree(1):
git subtree add --prefix "${Path}" "${Url}" "${Branch}"
This will automatically create a merge commit for the two histories and bring in all the commits from the other repository.
Next, you should clean up the additional files which are probably not needed anymore as they are also present in the release:
- .github/
- LICENSE
- NOTICE
- CODEOWNERS
- README.md
- ISSUE_TEMPLATE.md
- and other files you might find
The docs/ directory of repository should be merged into the docs/ directory of the release.
You should make sure that the repository is not referenced elsewhere as a submodule which
can be done via this link (replace ${Name}
with the name of the repository, e.g. routing-info
):
And also that the repository is not directly imported by someone as those imports will
no longer work (again, replace ${Name}
):
https://pkg.go.dev/code.cloudfoundry.org/${Name}?tab=importedby
Now you can push your branch and open a PR, make sure to include the two links so that the reviewer can double-check them.
Back in the original repository which was just added as a subtree, add this deprecation notice as a last change before archiving:
> [!CAUTION]
> This repository has been in-lined (using git-subtree) into routing-release. Please make any
> future contributions directly to routing-release.
And ask a repository admin to block further changes to this repository.
In the community repository, remove the repository
from the technical assets of the WG and set archived: true
in orgs/orgs.yml.
In the CI repository, remove the submodule from the submodule sync at *-release/linters/sync-submodule-config.bash and remove the README which is currently synced via CI from *-release/readme/.
You can find examples for all of these activities in routing-release#459. I recommend you look at the PRs of batch 3 as by that point I knew what I was doing and all the changes should be correct in the first PR to each repository.