Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to turn repos into subrepos? #633

Open
Kugeleis opened this issue Sep 22, 2024 · 1 comment
Open

How to turn repos into subrepos? #633

Kugeleis opened this issue Sep 22, 2024 · 1 comment

Comments

@Kugeleis
Copy link

I have a bunch of git repos fooand bar

myproject
 |
 |-foo
 |-bar

How can I convert them into subrepos of myproject?

@admorgan
Copy link
Collaborator

admorgan commented Feb 9, 2025

I don't understand this question. If you have myproject with the two specified directories you would typically want to make foo and or bar subrepos, but they would be subrepos of their own project and not subrepos of myproject. So lets walk through making foo and bar subrepos

You have myproject that has two libraries foo and bar. You would like to make foo into its own repo so others can benefit from your hard work in other projects.

From the myproject directory run git subrepo init foo --remote <place you are going to create the foo repo>
That will create a patch in my project that adds a .gitrepo file that tells subrepo these files are related to the external repo you specified in remote (you don't technically have to specify remote, but you will have to set one before you can push or pull). To send the files to the remote location you would do a git subrepo push foo. Assuming you are using github you would need to create the repo via the github interface first, but if you did this that repo would then have all the files in the foo directory and you can use the content accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants