WARNING: Work in progress
You can use `git subtree` to extract only one part of your repository, including its history. Here's a complete example on how to create new repositories from one repository with multiple directories.
Your initial repository structure looks like:
```
myrepo
├── dir1
│ ├── myfile1
│ ├── myfile2
│ └── myfile3
├── dir2
│ ├── myfile1
│ ├── myfile2
│ ├── myfile3
│ └── myfile4
└── dir3
└── myfile
```
On your computer, create empty repositories
```
mkdir /tmp/dir{1,2,3}
cd /tmp/dir1; git init --bare
cd /tmp/dir2; git init --bare
cd /tmp/dir3; git init --bare
```
Go to the original repository and create one branch per directory you want to split
```
cd myrepo
git subtree split --prefix=dir1 -b dir1
git subtree split --prefix=dir2 -b dir2
git subtree split --prefix=dir3 -b dir3
```
Push the branch of the original repository to the new local repositories on a new master branch
```
git push /tmp/dir1 dir1:master
git push /tmp/dir2 dir2:master
git push /tmp/dir3 dir3:master
```
Create the repositories on c4science, set the remote on your local repository for each new repository and push the new repositories to c4science
```
cd /tmp/dir1; git remote add origin ssh://git@c4science.ch/diffusion/NNNN/; git push -u origin master
cd /tmp/dir2; git remote add origin ssh://git@c4science.ch/diffusion/NNNN/; git push -u origin master
cd /tmp/dir3; git remote add origin ssh://git@c4science.ch/diffusion/NNNN/; git push -u origin master
```
Deactivate the original repository on c4science and potentially [[/maniphest/task/edit/form/8/ | ask an administrator]] to remove the repository.
Enjoy your new tinier repositories :-)