statquant
statquant

Reputation: 14370

Create submodules from a already created bitbucket repo

Hello I am using git and the web interface bitbucket I have the following structure in bitbucket

a
|-b
|-c

Thing is I want to be able to clone only c. I have red that submodules are the way to go.

How can I make c a submodule and clone it somewhere else ?

Upvotes: 0

Views: 1416

Answers (1)

kowsky
kowsky

Reputation: 14529

To achive the shown structure, you have to split your repository a in three different repositories a, b and c, and add repository b and c as submodules to your parent repository a.

This describes how to create a new repository from a subfolder of an existing one. Steps later than step 5 have to be adapted to bitbucket instead of GitHub, of course, but the process will be quite similar. If you do that for b and c (and for a if it contains any other files or folders than b and c, else you can just initialize a new empty repository) and add the submodules, you achieved your goal.

You should, however, defnitielty read about submodules before you use them (e.g. here or here), especially before you undertake such a serious reconstruction of your repository. Remember you will break the workflow for everyone who might still be working on your code.

Upvotes: 1

Related Questions