What is the cleanest way to create a git repository from an existing project when some subfolders are already git repositories?

I am starting work on an old code base located on a production server. I need to make a local duplicate, so I think the smart thing is this:

cd docroot git init git add . git commit -m "Files before I started work" git push origin // github account 

and then clone the repo into my dev block. However, some of the subfolders on the production server are separate git repositories for the various plugins that have been developed. Will this be the mess of the main repo that I create? I would like them to be as submodules, but how can I figure out the init process without breaking production files?

+4
source share
1 answer

Before adding โ€œeverything,โ€ you can create a .gitignore file to reference the path of the subdirectories, which are actually git repos.
They will not be added.

In this way:

  • you first commit will only represent what you need (i.e. not submodules)
  • you can later refer to subrepos as a submodule in your local clone of this new repo.
+1
source

Source: https://habr.com/ru/post/1436139/


All Articles