Open OliverJAsh opened 3 years ago
In this particular case, you could try
git imerge 7e5dce8
which would merge the individual commits 638c8ca
and 7e5dce8
into feature-3
. Assuming that 9d988ea
is not an evil merge, the resulting tree would be the same as merging 9d988ea
into feature-3
directly. You'd probably then want to merge 9d988ea
into that merge commit to get the right history graph, or fiddle around to make the history only include a single merge.
This could be automated for a history that looks like your master
history: each branch diverges from master then is merged back to master (possibly with conflicts), one at a time, without the branches overlapping in time, like this:
o-------o-----------o-------o ← master
\ \ / \ /
\ o---o---o o---o
\
o-------o-------o-------o ← branch
This is not very difficult, because the commits on master
can be put into a linear order.
But as soon as the history gets more complicated, it's hard to generalize. For example, what would one do in the following case?:
A---B
/ \
o---X---C ← master
\ / \
o o---o ← branch
It's not hard to imerge commits A
and B
into branch
, but when you get to C
things aren't so clear, because C
already contains the changes from commit X
, which are already in branch
. (Technically, the problem is that the merge of C
into branch
has two "merge bases", B
and X
.)
Sorry if this has already been asked, I tried to search for existing issues but couldn't find anything!
master
branch only contains merge commits.master
.master
into my feature branch.In this example I want to merge
master
intofeature-3
:When I do so using
git-imerge merge master
, if there's a conflict I see something like this:It's difficult to deal with this conflict because the merge commit on
master
contains many different changes.Is there a way I can use
git-imerge
so that it allows me to deal with conflicts between the original commits rather than between merge commits? In my example above the underlying merge conflict arises between7e5dce8 Amend a
and502ea6a Amend b
—I would likegit-imerge
to tell me this.