0

I am new to setting up Git server where i would like to add multiple projects under a single Git repository. At present i have a Git repository that contains only one project which contains "IOS project code" in a single folder . Now, i came across a situation where i need to add "MAC project code" also under the same repository but to a different folder.

I have been working with Microsoft Team foundation services where multiple projects can be added. Similarly i would like to have multiple projects under a single Git repository

Can you please provide me a solution to add my existing Mac Project code to existing Git repository?

Kamal
  • 453
  • 1
  • 10
  • 22
  • 2
    There are no "projects" in Git. You can add all the folders you want. That said, Microsoft's Team Foundation and other server technologies are often 1 "project" in a repository. – crashmstr Jun 18 '20 at 12:34
  • Generally it's better to have independent repositories for different projects. But if ultimately you really want this, just add a new folder and commits the new projects there. – Alejandro Jun 18 '20 at 12:34
  • @Alejandro Can you please suggest any links that can be referred? – Kamal Jun 18 '20 at 12:42
  • it is not clear what you want to have as a result, do you want to maintain and keep the IOS repo history while having it in the main repo? or is it that you want to discard the history of the IOS project? there are many ways to manage multiple project in the same git repo, and depending on your need you can use [subtree](https://blog.developer.atlassian.com/the-power-of-git-subtree/) or [submodule](https://git-scm.com/docs/git-submodule), if you don't want to maintain the history you can just move the IOS codebase as sub-folder in the main repo without `.git` directory. – ROOT Jun 18 '20 at 12:51
  • @ROOT I need to maintain both projects history in the repository and would like to manage IOS project code and MAC project in the same git repository – Kamal Jun 18 '20 at 13:01
  • @Kamal, then you have to use one of the methods mentioned in my previous comment, not sure but `substree` might be your way to go. – ROOT Jun 18 '20 at 13:04
  • @ROOT Do we need to create another repository for the new Project that i am going to add to the existing repository? The link you provided says that "Git subtree allows you to insert any repository as a sub-directory of another one" – Kamal Jun 18 '20 at 13:14
  • you don't have to create a new git repo, to clarify what subtree do, suppose that we have `repo A` and `repo B`, and we want to include `repo B` inside `repo A`, then you can use subtree to add `repo B` as a sub-folder inside `repo A`, also to know the differenece in subtree and sub-module, check this SO answer: https://stackoverflow.com/questions/31769820/differences-between-git-submodule-and-subtree#answer-31770145 – ROOT Jun 18 '20 at 13:24
  • @ROOT As per your previous comment , Are A and B are project folders? You are saying that repo.B should be added as sub folder to repo.A. That means project B resides inside project A? But i need the projects A and B in a same hierarchy under a single repository – Kamal Jun 18 '20 at 14:29

0 Answers0