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
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.