Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - maintain multiple versions

Tags:

git

I have a git repository with a web project. I want to customize this web project for different customers.

For example i have two customers c1 and c2. So i create two git branches: c1 and c2.

Every version has the same base system but different features. If i want to add a new feature or fix a bug in one branch there is no problem. But what if i want to change something that concern both branches. This results in a large amount of merge conflicts.

Can someone show me a better solution for my problem?

like image 964
user3241334 Avatar asked Jan 13 '16 16:01

user3241334


People also ask

How do I manage multiple versions in git?

Probably the easiest way is create branches for each version and then do for example git checkout v1. 0.14 or whatever branch you want to work on. The clients can then also check out the appropriate branch for the one they need as well as when upgrading to next version.

How do I keep git versioning?

Git can be enabled on a specific folder/directory on your file system to version files within that directory (including sub-directories). In git (and other version control systems) terms, this “tracked folder” is called a repository (which formally is a specific data structure storing versioning information).

What is the best git branching strategy?

Build your strategy from these three concepts: Use feature branches for all new features and bug fixes. Merge feature branches into the main branch using pull requests. Keep a high quality, up-to-date main branch.

Can we have multiple develop branch in git?

Keep in mind there is no set limit of development branches, so you can expand the number of development branches at any time without affecting your workflow. There are two workflows that will support this setup: Merging changes into a Master Branch.


1 Answers

I like GitHub feature Fork for solving such problems, main idea is to have separate repositories and copying commits using Pull Request or in some other way, with such approach both repositories will have common base and then will evolve as separate repositories.

To use same approach it is not necessary to use GitHub, you can just create several git repositories and then add additional remote, instead of Pull Request you can just use cherry-pick for copy commit from one repository to another. This approach will not help with solving conflicts in some better way.

Also you should think about modular way for development of common parts as separate modules, this can be done with submodules or with some other approach related to your programming language for example in Java you can develop module separately and then use it from other projects using dependency management functionality of Maven, Gradle or Ivy.

like image 99
Ivan M. Avatar answered Sep 24 '22 15:09

Ivan M.