No; at least, it's not (easily) possible to avoid or ignore this conflict. The edits are just too close together.
(What follows is a description of git's default behavior. Leon's answer shows one way to work around these limitations by defining a custom mergetool.)
Merging works by creating a patch (as with diff -u
) representing the changes in one branch, and applying it (as with patch
) to the other branch. In order to apply a patch, the context has to be the same. (See How do diff/patch work and how safe are they?) The context, i.e. the few lines surrounding the actual deletions and insertions in the diff, is what tells the patch tool that it is patching the right part of the file.
Git will not delete a line that doesn't exactly match the line that was deleted in the original, and it won't insert a line except between lines that exactly match the original. So it won't insert 'feature2' after 'F' because it says in the patch that 'feature2' comes after 'feature1' (and not after 'F').
When merging, you will have to resolve this conflict every time a change occurs in the vicinity of the conflict. This can get tedious when you apparently have to make the same correction for a few dozen commits in a row, but I don't know of a good way around it.
In certain circumstances, you may be able to use a different merge strategy to make your life easier. Be careful with this feature because some strategies are less conservative than the default and may be happy to break your code. Regardless, I don't think there is a merge strategy that will solve the example problem.