0

When I Commit and Push my code changes from Eclipse, one file shows only the code changes I have made on the Bitbucket server which is correct but the other file shows as if I have overwritten the whole file instead of just showing my code changes which is wrong. Can anyone suggest me what can be the issue?

Code committed and pushed from within Eclipse:

Code committed and pushed from eclipse

Here is the overwritten file on Bitbucket:

Here is the overwritten file on Bitbucket

Here is the file which shows only my code changes on Bitbucket:

Here is the file which shows only my code changes on bitbucket

howlger
  • 31,050
  • 11
  • 59
  • 99
  • 1
    I would guess that this is due to changed line breaks (CR LF vs. LF). Open a text editor and enable _Show Whitespace Characters_, e.g. via Quick Access (Ctrl+3), then in the _History_ view select the commit, right-click the committed file and choose _Compare with Previous Version_: Does the compare editor show different line breaks on the left side compared to on the right side? – howlger Apr 05 '19 at 18:26
  • When comparing both the versions, the indentation looks exactly the same except part of the code where I made changes (where indentation is almost the same too), [Here is the file](https://drive.google.com/file/d/1O6kSOQL0jfsc1r8rZUlixjXpzfac5Yax/view?usp=sharing). I have highlighted the differences, should not cause the issue. – Syed BilawalHassan Apr 08 '19 at 18:22
  • Are those the differences in the working tree? Please be aware that when using `autocrlf` in your Git configuration the line breaks in a committed file can be different from those in the files in the working tree. Please show a diff of the committed file to the previous commit in Eclipse. There must be a reason why Bitbucket shows all those lines as changed. – howlger Apr 08 '19 at 18:56
  • 1
    Yes, it was a problem related to **autocrlf**. Thanks for identifying the issue. [This problem fixed my issue](https://stackoverflow.com/questions/8227233/there-is-nothing-changed-but-eclipse-egit-marks-the-file-as-changed). Much appreciated, thanks again – Syed BilawalHassan Apr 08 '19 at 21:15

0 Answers0