How to work with different git branches?

Recently started to learn and work with git. Write a draft and as it turned out, he did large-scale grows. Now the project consists of 3 different applications:
- business is a separate business account for certain users
- frontend is actually the website
- backend admin

All the time I worked in 1 origin/master branch, but I want to do the following:
business - a separate branch
the frontend is a separate branch
backend is a separate branch
origin - the common thread.

So I created 3 additional branches. But I don't know what to do next. Ie I would like not to drag all your project files in each of the branches, and to do something like this:

folder business and her branch of the business
folder frontend and her branch frontend
the folder backend and for backend of her branch
folder the entire application and for her, the branch origin

Now I have created 3 empty branch and my public branch to origin please tell me how this is all put on the shelves ?
September 26th 19 at 06:57
3 answers
September 26th 19 at 06:59
Solution
This is absolutely not the right approach.
Backend specific version can not exist without a front-end to the appropriate version.
When they are divided into different branches - you zadolbali it all to release.

Read about git-flow habrahabr.ru/post/106912
the backend has nothing in frontend. There is a common folder, which contains shared models which are inherited by all models of business, frontend and backend. - Jaquelin_Gislason commented on September 26th 19 at 07:02
then the submodules - Savanna_Keeble commented on September 26th 19 at 07:05
backend can not have a relation to the frontend. they are always connected. - Savanna_Keeble commented on September 26th 19 at 07:08
a little bit more precise, I have a backend it's just the admin panel and the frontend is a website. Ie website can exist without admin and without admin panel of the website. Admin may have functionality that is not on the website and Vice versa. - Jaquelin_Gislason commented on September 26th 19 at 07:11
then I would have done so.
4 separate repository: common, front, backend, bussines.
In front/backend/common bussines plugin as submodule.
You can read for example git-scm.com/book/ru/%D0%98%D0%BD%D1%81%D1%82%D1%80... - Savanna_Keeble commented on September 26th 19 at 07:14
Dmitry thank you very much. I read about sub modules but did not understand a few things, can You explain to me the following:
For example, I have done as you said: "4 separate repository: common, front, backend, business."

1) On the server, it's all sticking in the same folder. Ie early to update the project I went to the root folder of the project and wrote: git pull. Now need to do git pull and git submodule update to update everything to the newest versions ?

2) if by commot folder there is a folder vendor and multiple files for console work, what to do then ? To clarify, I'm using Yii2 and just folder front, backend and business are separate applications that depend on common and vendor - Jaquelin_Gislason commented on September 26th 19 at 07:17
You may have code in folders spread :)
With submodule is an important point which we need to understand in your main repository, submodule is just a reference to a specific commit in another repository. So after you've done submodule update - you need to commit the current state to the main repository.
Generally it is easier to practise on a test which some turnips.

On the second issue, the right decision will not prompt, I am very far from Yii2.
As I recall there is a large enough coupling code.
Why do You have a desire to divide the repository into pieces? - Savanna_Keeble commented on September 26th 19 at 07:20
well, most likely, to wean themselves from habits to make a little changes in each section of the application and to do a General commit. - Jaquelin_Gislason commented on September 26th 19 at 07:23
September 26th 19 at 07:01
Solution
You are wrong to think. Git is not a system of hierarchies, and the version control system. No matter what where is, and as important as this work.
If it's three independent site - do 3 repository. If they have something in common (share the same styles, for example), then the total change in do in the master (origin-ω is usually called the main repository for synchronization, not the branch) and then pour this master in all three branches for each part of the site, and changes ARE NEVER TRANSFERRED to other branches in the branch for the relevant part of the website.
Yes, there is a shared common folder, which are inherited by all models. - Jaquelin_Gislason commented on September 26th 19 at 07:04
September 26th 19 at 07:03
Solution
Branches not needed for this. Not to do so.
If you want to separate different subsystems work - and scatter them in various repositories. But not the branches.
impossible, they all shared a common folder, which are inherited by all models. - Jaquelin_Gislason commented on September 26th 19 at 07:06
I do not see any obstacles. About the submodule have already written to you. - Savanna_Keeble commented on September 26th 19 at 07:09
yeah, they're digging in that direction. Did not know about the submodule - Savanna_Keeble commented on September 26th 19 at 07:12

Find more questions by tags Git