0

I have next merge conflict when merging release/77-fix:

<<<<<<< HEAD
                # Distinguish e.g. staging from front-end-dev etc.
                $environment_prefix = '.' . Proj::Env->host_group
                    if index($settings->{public}{brand}{domain}, Proj::Env->host_group) == -1;
||||||| f43fbfa064
                # Distinguish e.g. staging from front-end-dev, uat etc.
                $environment_prefix = '.' . Proj::Env->host_group;
=======
                # Distinguish e.g. staging from front-end-dev, uat etc.
                $environment_prefix = '.' . Proj::Env->host_group
                    if index($settings->{public}{brand}{domain}, Proj::Env->host_group) == -1;
>>>>>>> release/77-fix

I suppose this merge conflict should be resolved automatically, because HEAD already contain changes from release/77-fix

Here is change which cause conflict:

@@ -424,7 +424,7 @@ sub uri ($class, %args) {
             # the production environment's URLs.
             my $environment_prefix;
             if (Chimera::Env->running_in_test_environment) {
-                # Distinguish e.g. staging from front-end-dev, uat etc.
+                # Distinguish e.g. staging from front-end-dev etc.
                 $environment_prefix = '.' . Chimera::Env->host_group
                     if index($settings->{public}{brand}{domain}, Chimera::Env->host_grou>
             } elsif (Chimera::Env->running_in_development_environment) {

Is there an option to resolve this type of conflict automatically?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
  • Obviously, nobody has yet bothered to come up with an automation for this. It is the typical bread-and-butter conflict when changes occur in neighboring lines. What you consider as the "obvious" solution today may not be correct tomorrow. Not to mention that it is not obvious (sic!) how to automate "obvious" solutions. – j6t Sep 06 '22 at 10:57
  • If `HEAD` indeed would contain `release/77-fix` as you claim, git would not show the merge conflict. Without your local repo history and the commands you used, nobody can say exactly why your merge conflict appears. My guess is that you merged into `master/main` and did forget to `pull` your local `master` before the merge. The changes were in the remote `master`, yes, but not in your local `master`. At least that is what happens 99% of the time when I get surprising conflicts. – tomwaitforitmy Sep 06 '22 at 10:58
  • 1
    Do not use conflict style diff3 to get a better result. See also [Git Merge - Difference Between conflictStyle diff3 and merge](https://stackoverflow.com/questions/73333561/git-merge-difference-between-conflictstyle-diff3-and-merge). – j6t Sep 06 '22 at 11:46

0 Answers0