GIT Specific files for a branch?

I am wondering if it is possible to have a main repo with everything I need, configuration, application code, etc. (this is an MVC environment) and create branches from the main GIT repository only with specific models, controllers and views.

So I would have a main repo with

applications/* assets/* system/* 

And I would have a branch with

 applications/controllers/controller_name.php applications/model/model_name.php applications/views/view_name.php assets/modules/controller_name/* 

Then I could combine this branch into the main repo for each new “MVC installation”

It makes sense? And can this be done?
+6
source share
2 answers

Git does not branch out based on each file; it branches out based on the repository.

However, just because you create a branch with the entire repo does not mean that you must have all the same files in each branch.

+8
source

Git tracks snapshots of your codebase (see also the Git cast ). So, no matter what you want to distinguish from the main branch, you can track it in a separate branch. If this means that you will have new files in another branch, you can do it. If this means that you will have the same files that have been modified, you can do this.

I'm not sure what you mean “for every new MVC installation,” but it seems you find it difficult. It seems to me that you would like to have a “common framework” and then have “specific settings” based on that common framework. You can do this by having the main branch with the database and tracking changes / additions to the settings / all in separate installation branches.

This latter approach is often used for “product options” in practice. Usually you create common functionality in the main branch and merge it into each separate branch where you want it, or rebuild separate branches "on top of the wizard".

You can even get fantasy and cherry-pick individual commits from one branch, depending on the installation, to another, but I'm distracted.

+3
source

Source: https://habr.com/ru/post/909906/


All Articles