Reputation: 665
I'm currently working on a (laravel) project that should result in two versions, but I find myself constantly rebasing and merging my code. I guess it's my git workflow that is mistaken, but I need some heads up on what I'm doing wrong.
My macro-question is: Much like IntelliJ maintains dozens of IDEs that have almost the same basic functionalities but are built into different versions, is there some specific VCS tactic or best practices for doing so?
Say I have a project (one code base) that is for two clients A and B. A wants a blue theme and B wants a green one, so currently I just have them on two separate branches. These branches often have client-specific changes.
Now I have a new feature that I want to work on, which applies to both A and B. This is how I do it now:
new_feature_branch
from main
new_feature_branch
main
client_a_branch
and client_b_branch
on main
This works fine on normal features, but when there is a minor bug (say, a typo) on the main branch, having to go over all these every time just so that the patched code could get to the client branches just seem kind of awkward and... unintuitive(?) to me.
I just want to make sure if this is how "multiple versions with same code-base" projects are handled generally? If not, how is it commonly done? (A simple link or keyword to what I should look into would be helpful enough)
I'm totally unaware of how things work in production, and I'm also not confident about my git knowledge, so sorry if this question seems naive or whatsoever.
Thanks in advance!
Upvotes: 4
Views: 1386
Reputation: 29129
Rebase should be fine if:
main
. "Too far" is certainly subjective and case dependent, but imagine a scenario where each client branch has 100 of its own commits that heavily modify shared code. Eventually the rebase could become tedious with many merge conflicts needing to be resolved during rebase.Note: Commonly held beliefs regarding rebase are ending here, my opinions are below.
What should/could you do?
main
into the client branches instead of rebasing them onto the main
. I tend to prefer that workflow in general: "Rebase when you can and it makes sense, otherwise merge."main
branch. It took years to complete because of the complexity. Now we have different configs for each customer that have separate deployments, and for those that share the same physical runtime environments we have code switches or DB data differences based on the logged in user's company. Since we made the switch, all new development and deployments have been greatly simplified.If as you described, the only difference between clients is color themes or minor differences, then #2 should be fairly easy to achieve, I think.
Upvotes: 2