Multiple projects in one git repo?

前端 未结 3 956
一生所求
一生所求 2021-02-07 01:05

I\'m an SVN user at the moment and looking at moving my projects to git.

I use one SVN repository to hold all the projects I create. My structure is something like this:

相关标签:
3条回答
  • 2021-02-07 01:22

    You could have all the projects in one repository, but it's really bad idea, because you always have to work with the whole repo.

    To run a git server, if you need just one user (you), a server with installed git and ssh access is enough. See for example this article.

    0 讨论(0)
  • 2021-02-07 01:32

    In Git, it is better to have each project in its own repo, and the libraries in another repo if needed and used as submodules ( equivalent of svn externals) in each project.

    This is because in Git, a repo is a much more lightweight concept than SVN and also, more importantly, there is no ability to clone individual folders ( not to be confused with sparse checkout) within a repo separately like you are able to checkout and work on individual folders in SVN. So if you had all projects in a single repo, you will have to clone them all.

    Serving Git repos, using smart-http, git daemon and ssh is pretty straightforward. There is also Gitolite for managing multiple repos ( including authorization and authentication). Read the linked chapter on ProGit on serving Git repos- http://progit.org/book/ch4-2.html

    Coming to your grouping, you can put the repos in folders as per your grouping structure, and serve using, say smart http method, whereby the repo urls will look like the urls that you would have used with SVN, will all projects seeming to be under the grouping etc.

    0 讨论(0)
  • 2021-02-07 01:37

    In addition to the other answers, you can also use GitSlave to link multiple git repos together.

    0 讨论(0)
提交回复
热议问题