Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer repo B to repo A under subdirectory named xyz with commit history

Rushi Patel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 2, 2023

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.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 5, 2023

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

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

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 Now
AUG Leaders

Atlassian Community Events