S
S
Stanislav2017-02-17 00:25:47
git
Stanislav, 2017-02-17 00:25:47

GIT: What's the best way to deal with recurring conflicts when merging develop and production branches?

The question probably has an obvious answer that I just can't seem to get my search query right. Nevertheless, the situation is as follows:
There are two branches, in one of them the product is being developed, in the other, the version is stored for rolling out to the production server. Obviously, these two branches have different environment settings, let's take the simplest example - in the configuration file, in the case of a development branch, the local environment is specified, in the file for the production server - production.
Accordingly, when these two branches are merged, the value of this variable will be constantly replaced from production to local.
So, the question is: how is the workflow built so that this does not happen? And in general, how to properly merge, if in the two branches of the repository there must nevertheless always be some constantly present differences?
Clarification: of course, there are much more differences, so some kind of manual process is not of interest, it is desirable to build the workflow in such a way that this problem does not hurt the head once again.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Vasilyevich, 2017-02-17
@mariczzz

The solution, it seems, is quite obvious - take out all the settings in (configuration) files that are ignored by git. Make templates for these files (we leave them in git), and in the README of the project we describe the procedure for copying them to the right place and "adjusting" (which variables need to be changed, which ones to add / remove, etc.). On a specific site (production, stage, test, dev, local etc) there are own settings, everything is logical
. Another option is to use environment variables (environment variables), then files as such are not needed at all. But:
- their behavior is often difficult to control, and, as a result, it is difficult to catch errors with incorrect values
​​- they still need to be written somewhere (bash scripts, .htaccess, etc.), but now in different places
- it's still better to document it, at least so you don't forget it later :)

V
Victor, 2017-02-17
@v_decadence

How to merge branches but not merge multiple files?

S
sim3x, 2017-02-17
@sim3x

Obviously these two branches have different environment settings
no. The difference should be only in one variable, in which it is written in what environment the application is currently running.
The environment variable can be set by the export foo=bar
ADF: everything "secret" should not fall into the turnip and should also be in the environment variables

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question