s_t_e_v_e
s_t_e_v_e

Reputation: 2526

What is the convention for git local repository directory structure

Here is my git directory structure

~/git/ProjectA/.git
~/git/ProjectA/ProjectA
~/git/ProjectB/.git
~/git/ProjectB/ProjectB

Is that the convention or is it more preferable to do something like?

~/git/myRepo/.git
~/git/myRepo/ProjectA
~/git/myRepo/ProjectB

or

~/git/.git
~/git/ProjectA
~/git/ProjectB

or something else entirely?

Upvotes: 1

Views: 3563

Answers (2)

Rob
Rob

Reputation: 11733

Simple answer: depends on whether you want to use submodules. If you do, then the subdirectories will contain complete projects that you will have to go into and push and pull from.

If you have a parent project with a bunch of dependent sub projects, e.g. a core project that has your domain classes, then a ui project that builds all the components, etc., then just put those things into subdirectories. They can still be separate projects.

If you have existing projects and want to draw them up into one project, see this question I asked some time ago (that drew some really good responses): How to Migrate Git Projects to Be One Project with Subprojects

Upvotes: 1

villadelfia
villadelfia

Reputation: 66

There is no convention per se, but it stands to reason that you use version control for versioning a single project at a time, unless they are sub-projects of a bigger project.

That said, the way you are doing it now conforms to that "convention" of one project per repo.

Upvotes: 3

Related Questions