2

I am trying to merge some revisions in IntelliJ and it showed a diff for me. Unfortunately, diff does not notice identical code and inserts strange text like

<<<<<<<HEAD

into result.

Here is screenshot. As you see, code is identical, but it is colored somewhere red and somewhere blue.

enter image description here

How to restore normal merge functionality?

1
  • actually its not a strange text, it shows your current code in a place of conflict when you try to merge with another commit. It 'll be more clear if you can screen shot and put the full file. :)) Commented Nov 8, 2016 at 3:13

1 Answer 1

1

What you have here is a merge conflict. You can read here for more information about how IntelliJ handles conflicts under Conflict Resolution Tool here: https://www.jetbrains.com/help/idea/2016.2/resolving-conflicts.html

The "strange text" is injected into the conflicted file by Git, so you would see these even outside the IntelliJ merge tool. If the local and remote content differs, a line of = signs will be the divider between your local version and the remote version. In this case since both revisions are equal, you simply have a single line conflict with the same content from both sources.

Essentially, you need to choose which revision of the code to use by selecting the chevrons & X's on either side of the window panel of your screenshot. There is also a handy 'merge non-conflicting changes' button that makes reviewing the actual conflicts much easier.

Sign up to request clarification or add additional context in comments.

2 Comments

Why is it displaying conflict this way? I had a lot of conflicts previously, and they were displayed different way. I was able to choose either left or right or both. No any text was injected.
Look at your own Jetbrains link. It has conflict too. Both sides are red, which means conflict. At any side I can press either ">>" or "x". I can press "x" at both sides and I can press ">>" at both sides too. And there is no any ">>>>>>>>>>>>>" in result text. This is how it was behaving all the time previously.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.