My file had a newline, inserted from a Windows machine into the git repo. Screenshot :-
Notice the New Line between the brackets. This was from a Windows machine. The last bracket is end-of-class bracket, and other one is end-of-function bracket
Now, another user from a Ubuntu Linux Machine, removed this new line and added a new method in the end.
The code till the second-last bracket, was also present in the target branch. The Linux user, added the code below it, and automerge was supposed to merge only the new code (or throw a conflict).
Git auto merge ran, without throwing a conflict, but automerged, and redundantly copied and pasted a few lines of code, including the second-last bracket.
What could be a potential cause of this? Let me know if any additional details is need or not.