I want to transfer "develop" branch of repository B to repository A's subdirectory named "xyz" under branch "main/develop" of repository A by preserving all commit history of repository B for branch "develop".
I have tried bundle, subtree, submodule, mirror, bare, but some transfers the data with no commit history and git filter-repo doesnt help me transfer the files itself.
Can someone please suggest solution from mac terminal or UI of bitbucket.
Hi @Rushi Patel and welcome to the community!
You can use a submodule for this purpose. In a clone of repository A, check out the branch where you want to have repo B.
You can then use the following command
git submodule add -b develop git@bitbucket.org:workspace-id/repo-B.git xyz
where workspace-id is the id of the workspace that repo-B belongs to
xyz is the name of the directory where the submodule will be saved
This command will create a directory named xyz, and the branch develop of repo-B will be cloned in this directory.
Please keep in mind that the commits of "develop" branch of repo-B will not be part of the repo's A history.
A submodule allows you to keep a Git repository (repo B in your case) as a subdirectory of another Git repository (repo A). So, the history of "develop" branch of repo-B will be inside the xyz directory.
You can find more info about how to work with submodules on the official Git documentation here:
Is this something that works for you?
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.