How to view a whitelabel project?

Asked

Viewed 50 times

0

Good morning guys, I’ve been working on git for a while, but I ran into a problem that I couldn’t find a solution that works. I have a "white label" project, which would go like this: It has a "main" branch where practically all the project code is, and I have other "client" branches that are customized with colors, logo, name and url of each project’s api. Where I hooked up is that I don’t know how to manage updates in code without merging and overwriting the settings of each of the branches "clients".

Does anyone have any tips to facilitate this integration, without having to manually replicate on each branch?

1 answer

0


Yes this is possible by defining a strategy for the file or a folder.

For example, imagine that in your project there is a client logo that you want to preserve in the merge, and that is in the path: "images/logo.png"

You can create an attribute for this file and define the merge strategy. To do this, create a file .gitattributes in the structure of your project, and include the following content:

/images/logo.png merge=ours

This tells git that when merging, it should keep its version (Ours). You should do this on all branchs that contain the same file. That would be as if the merge were manual and choose your version.

When merging, inform that you will use this strategy with the command git config merge.ours.driver true. If you are using an IDE to execute the commands, run once git config --global merge.ours.driver true and this will be standard and can merge/rebase smoothly through the IDE.

  • Thank you very much, I will search more about gitattributes!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.