I have ten projects in SVN which are independent on one another. Now i want to migrate to git. In order to maintain all the projects in git, what is the best approach for doing that. All the ten projects in SVN are not dependent on one another and all are in different languages like Java, C#,...
-
2if the projects are independent, why try to maintain them together? I would put them in different git repositories and do a checkout on each of them. alternatively you can look into git submodules https://git-scm.com/book/en/v2/Git-Tools-Submodules – kalgecin Mar 22 '18 at 08:58
5 Answers
Below are the things I am clear on your question :
- All the projects are independent.
- You may have the different sets of users accessing each project and you have to maintain permissions for different user sets.
Based on these things please find my suggestion :
- It is better to maintain a separate repo for each project in Git
- You can restrict the set of users working on each project
- It is easy to pull the code related to the particular project like for C# copy you can get it in visual studio using C# repo and For Java copy you can get it in eclipse using Java Repo.

- 1,189
- 7
- 20
-
4Not only that but, I don't know of anyone with their whole dev portfolio in a single Git Repository, that would be absurd, inefficient and likely to create problems anyways. – Antry Mar 22 '18 at 09:32
I think you should convert all projects to git.
How to do this: How do I migrate a SVN repo with history to a new git repo
If you need a local installation, you can take a look at GitLab CE gitlab

- 7,005
- 8
- 44
- 50
If you projects are Independent, totally unrelated and will never interact together and no one is ever going to have the need to pull multiple of your projects anyways, just keep them as 10 repositories.
If you have independent but related projects which you would like in a "solution" still create 10 repositories, but look into Git-submodules, so that you have a Parent repository which has a relation towards other git repositories
Method 1:
Cleanly Migrate Your Subversion Repository To a GIT Repository
Method 2:
If you've got local source code you want to add to a new remote new git repository without 'cloning' the remote first, do the following (create your empty remote repository in bitbucket/github etc, then push up your source)
Create the remote repository, and get the URL such as
git://github.com/youruser/somename.git
(or any remote host repository service)Locally, at the root directory of your source,
git init
Locally, add and commit what you want in your initial repo (for everything,
git add .
git commit -m 'initial commit comment')
to attach your remote repo with the name 'origin' (like cloning would do)
git remote add origin [URL From Step 1]
to push up your master branch (change master to something else for a different branch):
git push -u origin master

- 448
- 3
- 9
-
my question is i have many projects which is independent on another like java projects and some c# projects.Do i need to create each repo for each project. – Anu699 Mar 22 '18 at 09:21
-
2@Anu699 If you have 10 projects who have nothing to do with each other, Yes, create 10 repos. If you ever need to interconnect them in a future project, you will be able to use Sub-modules (having a reference to git repo, inside a other git repo). If you want to migrate your current SVN to git, look at my link, it lets you keep your users too. If your SVN is all 10 projects inside one, probably look into splitting them up into 10 git repos. – Antry Mar 22 '18 at 09:24
-
I would suggest creating a separate git repository for each of the projects.
If however, you need to group the repositories together so that your development team can easily checkout the entire stack of technologies, you can use Git Sub Modules
git submodule add <Project1_url>
git submodule add <Project2_url>
This will create a .gitmodules file that you could edit if need be

- 93
- 1
- 9
-
1I don't really see the relevance here, he specified that the projects did not need interconnection, why would he make submodules ? – Antry Mar 22 '18 at 09:03
-
if the projects are under one logical group, it makes sense to keep them in submodules. e.g. if you have a front-end and back-end code, it would be logical to make one base git project and put the two separate git projects as submodules into the base. this would help developers checkout the whole project at once without having to individually checkout the repos – kalgecin Mar 22 '18 at 09:06
-
@kalgecin That's correct, but the OP already stated that projects are not related to each other, so your answer doesn't answer the question. – BackSlash Mar 22 '18 at 09:10
-
I don't frown upon submodules and their use, it's just that from my understanding of the question, he is saying that they do not need any connexion between them, hence he should just create his 10 individual repos, possibly use them as submodules later if needed in a core project. I agree with you. But the more I read the question, the more ambiguous it becomes because of some grammar mistakes. – Antry Mar 22 '18 at 09:10
-
from his question, i understood that he wants to maintain the 10 projects together, thus my suggestion. if he just wanted to move from svn to git, why mention the group of projects? – kalgecin Mar 22 '18 at 09:12
-
@kalgecin This is the OP question, rephrased: "I have 10 independent projects written in different languages, should I put them on the same repo or should I create 10 different repos instead?". He is not talking about grouping projects or modules. – BackSlash Mar 22 '18 at 09:15
-
why would he even consider maintaining them under one repo if they were in different svn repositories to begin with? – kalgecin Mar 22 '18 at 09:18
-
@kalgecin Also probably the fact that he came here because of his limited knowledge of it and maybe English isn't his tongue – Antry Mar 22 '18 at 09:19
-
@kalgecin I don't think he ever did want to maintain under one repo, that is what he tried to clumsily explain – Antry Mar 22 '18 at 09:20
-
-
I understood the things but i have less knowledge on git.So i am asking is it ok to maintains seperate repos for each project or is there any possibility as in SVN we can maitain all projects in one repository folder. – Anu699 Mar 22 '18 at 09:24
-
yes, you can maintain the projects in one repository if you choose to, using the git submodules. what git submodules does is bring the different repositories under one folder and you can keep track of each of the different repositories that way. but you would still need to make a separate git repository for each of the projects to maintain them independently. – kalgecin Mar 22 '18 at 09:27
-
@kalgecin Did you mean even if i want to maitain using submodules i need to create each repo for each project ? – Anu699 Mar 22 '18 at 09:33
-
yes, you create repo for each project, then create another base repo to manage the different projects using the submodules if you need to. but if the projects are totally unrelated, then you do not need the base repo. – kalgecin Mar 22 '18 at 09:36
-
Okay Thank you...What about sprace checkout as Nelson mentioned in his answer – Anu699 Mar 22 '18 at 09:44
-
https://stackoverflow.com/questions/4114887/is-it-possible-to-do-a-sparse-checkout-without-checking-out-the-whole-repository this answer would explain it best – kalgecin Mar 22 '18 at 09:48
We had a similar use case where there was different technology projects present in SVN. We followed the same structure and created a project and a repository in GIT. Then when the individual teams started working on their modules or if the build jobs need only specific checkouts from the git repo, sparse checkout was used.

- 67
- 3