-2

I'm starting a new project and I'd like to plan it's use with git (using SourceTree) before starting. I work as a self developer and I'm starting a project that will have 3 different areas. This is what is confusing me on what should I do to use git properly.

Basically the project will have this structure:

  • Shared: Some code shared between the different areas (e.g. css style, connection to the database);
  • App: A restricted area for users/clients only;
  • Panel: A restricted area for the admins only;
  • WebSite: A public website to serve as a landing page;

What should I do in this case? Should I have different branchs for each area? Currently I'm using Git Flow (which is being very useful), but I don't know if it would be ok to keep all of them on the same branch (let's say on the develop) or create one for each area, e.g. dev/app, dev/admin and dev/website.

Each area may (and problably will) need different type of maintenance, so app can be on currently development while website no.

When reading about this topic I could found some content telling to keep track of each area in it's own way, but I don't know how to structure this on the branches. What would be better to consider on this scenario? Or what other suggestion youc an give me on this? Until today I just worked with git on simple projects, such a simple WebSite, with just one line of development and the Git Flow was just enough (master, develop, feature and hotfix).

  • 2
    You don't benefit anything from branches exclusive for different parts of the same software. If we would talk about, let's say a website and an app, then it might be useful to develop the website and the app in different repositories; but yet again: no branches. Put them all together in one development branch. – bash0r Jul 15 '17 at 13:41
  • What do you mean by "area"? It sounds like you are working with different executables/webpages that all share the same back-end. Is that the case, or are they independent code bases that don't rely on each other? – Kyle A Jul 15 '17 at 13:41
  • @KyleA Yes, that's what i meant. It's, for example, a website where you can login and get resirect the the 'app' área or the 'admin' área, depending on your role. – celsomtrindade Jul 15 '17 at 15:12
  • Are you searching for git submodules? – BlueWizard Jul 15 '17 at 21:48
3

The usage of the term "area" is a little unclear to me, but I'm understanding that you have multiple applications and webpages that share the same back-end code. If they all depend on the same back-end like this, then improvements to one will probably also impact the others, even if only indirectly. In this case, I would just organize them in different folders in the same branch.

If these applications and webpages don't depend on each other or share a back-end, then they probably belong in separate repositories.

Branches are not intended for separating different executables within a single repository. They are intended for organizing different development efforts so that developers won't step on each others' toes as often when working on the same code base.

  • Git doesn't really care whether you use different repos or different branches for different resources, but using branches like this is quite uncommon (though not totally unheard of, GitHub's use of a special gh-pages branch comes to mind). The main problem is that you can only check out a single branch per workspace, which here would mean being able to see only the App area OR the Admin area. And branch naming becomes more confusing: There can only be a single default master branch per Git repository. – amon Jul 16 '17 at 20:16
  • @amon, True. Git will let you do this. I was simply commenting that branches were created for a different purpose and most programmers will expect your branches to be used for the intended purpose. Also, I can't really think of a real benefit from splitting the project across branches as opposed to using directories within a branch or separate repositories. – Kyle A Jul 20 '17 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.