These alternate changes to the files in two feature branches and there 
subsequent 'lost changes' during the re-merges appears to come up 
moderately often.

The usual 'cause' is that the merge process is three way, so includes the 
common fork point for the features from the main branch (your naming may 
vary). Git then has some priorities regarding how to decide which side 
actually changed, and what to do. Also it can (maybe in this case) find 
that the useful common fork point isn't the one you expected.

The common issue is that a change has been effectively reverted on side, so 
no conflict is detected, and the other side's changes are accepted as being 
the only changes. This sounds like it has a similar feel. I think there is 
a note buried way down the merge documentation, but that's just a feeling 
from memory.

A short minimal  MVCE would allow others to cross check that the 
description (as read) matches the command sequence, and spot the 
misunderstanding.

Philip

On Thursday, September 24, 2020 at 5:03:17 PM UTC+1 Tassilo Horn wrote:

> SJW <shannon...@gmail.com> writes:
>
> > I branched out master (feature-1) and made some changes to file1.php
> >
> > I branched out master (feature-2 : without changes to file1.php merged
> > back) and made some other changes to file1.php
> >
> > Eventually, I merged feature-1 back to master.
> > Then I merged feature-2 back to master.
> >
> > It appears that the merge in feature-2 has reverted the changes in 
> > feature-1.
> >
> > Is that possible?
>
> Of course, there are endless ways to shoot yourself in the foot. ;-)
>
> > I thought git would be able to handle that?
>
> It is. In case the same parts of file1.php where modified on both
> feature-1 and feature-2, you should have gotten a conflict after merging
> feature-2 after feature-1, otherwise all changes of both branches should
> have been in the result.
>
> So maybe you actually got a conflict and resolved it using the base
> version, i.e., the version of file1.php before both branches spun off?
>
> Without any details, nobody can know but rest assured, reverting changes
> during a merge is not the standard behavior.
>
> Bye,
> Tassilo
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/6aed91d7-b3d0-4727-b972-a816f62934d4n%40googlegroups.com.

Reply via email to