2

After merging dev branch into my feature branch, I want to show the difference in IntelliJ Idea, I see some files changed (which might not have been changed) with the ones which I have really changed!

Then I double click on that file and see this message in the above of the window open:

"Contents are identical".

So it has become really a problem, because I want to revert this particular change, but it doesn't let me to revert. Yet have not committed or pushed anythig. git status command also shows that change. I do git reset --hard and it goes in the previous state, as if nothing has happened, again doing git merge dev from my feature branch, and again the same...

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
Hayk Mkhitaryan
  • 388
  • 9
  • 26
  • How do you try to revert ? – Ôrel Jun 23 '20 at 20:44
  • @Ôrel git reset --hard, but it reverts everything. So I have to do the same merge with dev branch again. – Hayk Mkhitaryan Jun 23 '20 at 20:46
  • `git merge` will create a commit so `git reset --hard` will not do anything. Are you sure you are not triggering a conflict ? – Ôrel Jun 23 '20 at 20:47
  • no, no conflicts – Hayk Mkhitaryan Jun 23 '20 at 20:49
  • What are you showing the difference between? Make sure it's between your local branch with the remote branch – apokryfos Jun 23 '20 at 20:50
  • @apokryfos sorry? – Hayk Mkhitaryan Jun 23 '20 at 20:52
  • 1
    When you merge your dev branch into the feature branch it will basically merge the commits that are in the dev branch but not in the feature branch. They will automatically become part of your local feature branch so you do not need to actually commit anything else. What you need to do for the merge to "stick" is to push it to the remote (if you have one). Because of this, you will not see any uncommitted changes in your feature branch because they are all part of merged commits. If you (like me) are from an SVN background this will take some getting used to. – apokryfos Jun 23 '20 at 20:56
  • yes, it is. Guys seems this is the "line endings" problem, but don't know how to resolve the issue. – Hayk Mkhitaryan Jun 23 '20 at 20:56
  • IntelliJ has the option to ignore whitespaces in its default diff view maybe you can try turning that off as well – apokryfos Jun 23 '20 at 20:58
  • Can you Please show this option in intellij. I am not able to find it. – Hayk Mkhitaryan Jun 23 '20 at 20:59
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/216526/discussion-between-hayk-mkhitaryan-and-apokryfos). – Hayk Mkhitaryan Jun 23 '20 at 21:02

2 Answers2

5

In my case, I have added the below config:

git config core.fileMode false

See https://git-scm.com/docs/git-config#Documentation/git-config.txt-corefileMode

marcioggs
  • 648
  • 11
  • 23
sarath
  • 767
  • 12
  • 19
0

File > Settings... (or Ctrl+Alt+S) > Editor > General > Virtual Space section >

Check:

Allow placement of caret inside tabs.

Uncheck:

Allow placement of caret after end of line.

If it still doesn't work afterwards, re-checking and restarting it. Then uncheck and hit apply.

Look at this question: How do I turn off the unlimited whitespace in IntelliJ editor?

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34