0

We are using github to manage our project. In my project we have two modules one for front-end and one for back-end.

I have one git repo and I am going to push my back-end code in it. Now, I want to make a submodule in that repo and want to push front-end code in it.

Q-> Is it required to make a seperate git repo for front-end and then I have to link it my main repo by running below command ?

git submodule add gitRepoUrl /path/of/submodule

Q-> How can I make a folder of an existing git repo a submodule ? (Do I have to make that folder a git repo first and then have to link it in main repo)

Thanks

1 Answer 1

2

git submodules are by definition links to commit objects of a separate repository, so it is required to create an own repository for the part of the code you want to include as submodule.

In your situation, I would spend some thoughts on the layout. Is the front-end really a submodule of the back-end? This sounds unlikely.

As for the second question: You need to extract the folder into an own repository. There are multiple guides on how to do that. Afterwards, you can include the newly created repository as submodule.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for sharing this. I know layout is little strange but its client requirements so I have to follow this.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.