Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Git - Group several projects and push for first time.

Options
  • 12-02-2014 12:38am
    #1
    Registered Users Posts: 8,449 ✭✭✭


    Hi guys,

    Just wondering about how I would do this:

    I have a maven project but it has multiple folders. I'm trying to have a base setup project from which I will be able to clone off of so I don't have to do a load of project set up any time in the future. I'll have a fresh copy untouched.

    But when I try to push to git local or even bitbucket I can only do it so that there is no overarching parent folder, just each individual project/submodule.

    My heads a bit melted so it's probably not the best wording.

    e.g.

    -->fresh_setup_project (which I want to be able to just clone from bitbucket)

    > submodule
    > submodule
    > submodule

    basically I want to be able to add to git repo so that the the parent folder is the the top level folder and the others are contained within it. So far I've been doing seperate git repos per submodule...

    Any help? Thanks :D


Comments

  • Registered Users Posts: 586 ✭✭✭Aswerty


    I use Mercurial but I think Git works the same in this case.

    Say if you have a project called MyProject and it has 3 sub folders FolderA, FolderB and FolderC. The way you put the project into source control is that you create a repo inside MyProject. Due to this you won't have your top level directory MyProject. The top level in the repo will be the 3 folders. When you then need to clone this repo what you do is specify the project name to be MyProject. So I think it goes something like this in Git
    git clone "your url" MyProject

    So when cloning this is how you can reapply the top level directory. It does mean different developers may have different top level directory names if they so wish.

    I think the above answers your question.


  • Registered Users Posts: 27,161 ✭✭✭✭GreeBo


    Will the submodules all have the same version (that of the over-arching project)?
    In other words, do you have a pom.xml at the fresh_setup_project level that is listing submodule1-x?

    If not then I would advise against this approach as you are going to have lots of fun with the submodules.


  • Registered Users Posts: 8,449 ✭✭✭Call Me Jimmy


    GreeBo wrote: »
    Will the submodules all have the same version (that of the over-arching project)?
    In other words, do you have a pom.xml at the fresh_setup_project level that is listing submodule1-x?

    If not then I would advise against this approach as you are going to have lots of fun with the submodules.

    Well I managed to work my way through a good tutorial, so what I did was, did the whole git init process for the top level folder and got it working. So if I go onto bitbucket for example, I have the repo and it shows the top level folder. So in a sense I have it working.

    But I'm interested to hear about the problem if I have different version of subprojects? I will probably version them all as the one overarching project version but does it get messy fast if I have them versioned separately?

    There IS an overarching pom in the top level folder.


  • Registered Users Posts: 27,161 ✭✭✭✭GreeBo


    Well I managed to work my way through a good tutorial, so what I did was, did the whole git init process for the top level folder and got it working. So if I go onto bitbucket for example, I have the repo and it shows the top level folder. So in a sense I have it working.

    But I'm interested to hear about the problem if I have different version of subprojects? I will probably version them all as the one overarching project version but does it get messy fast if I have them versioned separately?

    There IS an overarching pom in the top level folder.

    If they all have their versions managed by the top level pom then its fine.
    It could get interesting if you are managing their versions independently yet they are all part of the same branch/tag/etc in GIT.

    Typically I would manage things that are versioned independently in different source control projects so that they can be worked on independently.
    If they are dependencies then separate them out and isolate them in source control, just listing them as dependencies in your poms. If they are truly sub modules then keep them together in source control and manage them as a single version via your multi-module "parent" pom.


Advertisement